diff options
Diffstat (limited to 'src/frame.c')
-rw-r--r-- | src/frame.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/frame.c b/src/frame.c index 6323872..fbfd1f2 100644 --- a/src/frame.c +++ b/src/frame.c @@ -959,3 +959,24 @@ SCBlock *block_at_cursor(struct frame *fr, int pn, size_t pos) return para->macro_real_scblock; } + + +int get_sc_pos(struct frame *fr, int pn, size_t pos, + SCBlock **bl, size_t *ppos) +{ + Paragraph *para = fr->paras[pn]; + int nrun; + struct text_run *run; + + nrun = which_run(para, pos); + if ( nrun == para->n_runs ) { + fprintf(stderr, "Couldn't find run to insert into.\n"); + return 1; + } + run = ¶->runs[nrun]; + + *ppos = run->scblock_offs_bytes + pos - run->para_offs_bytes; + *bl = run->scblock; + + return 0; +} |