diff options
author | Thomas White <taw@physics.org> | 2018-02-18 19:48:22 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-02-19 20:19:04 +0100 |
commit | 889bff2106db15c5bb7100e7fdd6f14ad6ae2bd5 (patch) | |
tree | 1edfd15832470fb43376376dca1933c5d06827a0 /src/sc_interp.c | |
parent | 66d7abfe17971edc86ac3b06b272d9234f0b4cfe (diff) |
Remove text run SCBlock offset
The \newpara change (commit 7f2d0abd) removed the only situation when the
start of a run might not coincide with the start of an SCBlock, or vice-versa
(although not all SCBlocks correspond to text runs, obviously).
Therefore, the offset is always zero and can be removed, simplifying the code.
Diffstat (limited to 'src/sc_interp.c')
-rw-r--r-- | src/sc_interp.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/sc_interp.c b/src/sc_interp.c index efdffa6..24dd4ee 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -946,7 +946,7 @@ static int add_text(struct frame *fr, PangoContext *pc, SCBlock *bl, PangoLanguage *lang, int editable, SCInterpreter *scin) { const char *text = sc_block_contents(bl); - size_t start, len_bytes; + size_t len_bytes; PangoFontDescription *fontdesc; double *col; struct sc_state *st = &scin->state[scin->j]; @@ -961,18 +961,10 @@ static int add_text(struct frame *fr, PangoContext *pc, SCBlock *bl, mrb = sc_interp_get_macro_real_block(scin); len_bytes = strlen(text); - start = 0; - do { - - size_t len = strlen(text+start); - - Paragraph *para = last_open_para(fr); - add_run(para, bl, mrb, st->macro_contents, start, len, - fontdesc, col, st->macro_editable); - set_para_spacing(para, st->paraspace); - start += len; - - } while ( start < len_bytes ); + Paragraph *para = last_open_para(fr); + add_run(para, bl, mrb, st->macro_contents, len_bytes, + fontdesc, col, st->macro_editable); + set_para_spacing(para, st->paraspace); return 0; } @@ -1032,7 +1024,7 @@ static int check_outputs(SCBlock *bl, SCInterpreter *scin) Paragraph *para = last_open_para(fr); struct sc_state *st = &scin->state[scin->j]; /* Add a dummy run which we can type into */ - add_run(para, bl, st->macro_real_block, st->macro_contents, 0, 0, + add_run(para, bl, st->macro_real_block, st->macro_contents, 0, sc_interp_get_fontdesc(scin), fr->col, st->macro_editable); set_newline_at_end(para, bl); close_last_paragraph(fr); |