diff options
author | Thomas White <taw@bitwiz.org.uk> | 2016-04-26 23:12:45 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2016-04-26 23:12:45 +0200 |
commit | 9cf3a70f71dbcebf76597880c0b998a49c95bf7c (patch) | |
tree | 31dcd0925e86cb6c03880d767ed381c6de05d553 /src/frame.c | |
parent | 1d2e905763d2c403e54850d61044065b238e16bc (diff) |
Paste slide
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; +} |