diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-12 15:41:11 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-12 15:41:11 +0100 |
commit | 1672b79734ca5c37d5609b5d44ac63a60c5f2dae (patch) | |
tree | 5ab8e907df360b5b852a96b65dabd21ab3f23914 /src/render | |
parent | 47b0c8df73dc15599a19017cc7691cebb6d0b918 (diff) | |
download | chawan-1672b79734ca5c37d5609b5d44ac63a60c5f2dae.tar.gz |
renderdocument: fix another formatting bug
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/renderdocument.nim | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim index 5493c2f5..914ada85 100644 --- a/src/render/renderdocument.nim +++ b/src/render/renderdocument.nim @@ -132,9 +132,11 @@ proc setText(lines: var FlexibleGrid, linestr: string, cformat: ComputedFormat, lines[y].insertFormat(px, fi, format, cformat) inc fi - if i < ostr.len: - # nx < ostr.width, so insert the continuation of the last format we - # replaced after our string. (default format when the last didn't exist.) + if i < ostr.len and (fi >= lines[y].formats.len or lines[y].formats[fi].pos > nx): + # nx < ostr.width, but we have removed all formatting in the range of our + # string, and no formatting comes directly after it. So we insert the + # continuation of the last format we replaced after our string. + # (Default format when we haven't replaced anything.) lines[y].insertFormat(nx, fi, lformat) dec fi # go back to previous format, so that pos <= nx |