diff options
author | bptato <nincsnevem662@gmail.com> | 2023-01-07 22:31:20 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-01-07 22:34:40 +0100 |
commit | 844fec3672b6b3f5da3362798e93036e20e9fac9 (patch) | |
tree | 924bf316f9a768b8e77c8098e4d6872fffdabad7 /src/render | |
parent | 230ad9476b296436c67a3e269b21e67b179b6f19 (diff) | |
download | chawan-844fec3672b6b3f5da3362798e93036e20e9fac9.tar.gz |
renderdocument: fix failing assertion
I'm not sure if it was actually causing other issues, but better safe than sorry: formatting is no longer inserted for negative x coordinates.
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/renderdocument.nim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim index 1d4c28f1..31bdfcf2 100644 --- a/src/render/renderdocument.nim +++ b/src/render/renderdocument.nim @@ -68,6 +68,14 @@ proc setText(lines: var FlexibleGrid, linestr: string, cformat: ComputedFormat, if i < ostr.len: lines[y].str &= ostr.substr(i) + # Negative x values make no sense from here on, as text with negative x + # coordinates can not be formatted. + let x = max(0, x) + if cx < 0: + cx = 0 + if nx < 0: + nx = 0 + # Skip unchanged formats before the new string var fi = lines[y].findFormatN(cx) - 1 |