diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-08 23:42:11 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-08 23:44:40 +0100 |
commit | 431fd101705146f2d4baaa1a4a139adf356188ab (patch) | |
tree | 002fdfecce7eab209f76a36467023bc0f761b125 /src/server | |
parent | a37af56817baa9c6fa1d0ecb6c1800222cf086bb (diff) | |
download | chawan-431fd101705146f2d4baaa1a4a139adf356188ab.tar.gz |
buffer: fix index defect in updateHover
Caused by a race condition when updateHover is executed after buffer.lines.len changed in buffer but before the change has been reported to container.
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/buffer.nim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/server/buffer.nim b/src/server/buffer.nim index cbefc5a2..e5cdf50d 100644 --- a/src/server/buffer.nim +++ b/src/server/buffer.nim @@ -661,7 +661,8 @@ type UpdateHoverResult* = object repaint*: bool proc updateHover*(buffer: Buffer, cursorx, cursory: int): UpdateHoverResult {.proxy.} = - if buffer.lines.len == 0: return + if cursory >= buffer.lines.len: + return var thisnode: StyledNode let i = buffer.lines[cursory].findFormatN(cursorx) - 1 if i >= 0: |