fix bugs in implementing and using text buffer. Some functions did not save the drawMsg to the app's state, which we means we didn't draw in those cases. The text builder functions also drew cursors on characters even when the cursor is not at this position. Both of these bugs are fixed.

This commit is contained in:
2025-09-12 23:21:53 +01:00
parent 77a64ae794
commit 422d6ad9ac
6 changed files with 14 additions and 16 deletions

View File

@@ -27,7 +27,6 @@ struct
(* get relative index of line to start building from *)
val strPos =
Utils.getRelativeLineStartFromRightHead (startLine, curLine, lhd)
+ 1
(* get absolute idx of line *)
val absIdx = curIdx + strPos
val searchPos = BinSearch.equalOrMore (absIdx, searchList)

View File

@@ -207,8 +207,7 @@ struct
in Utils.makeCursorOnChr (chr, posX, posY, env) :: acc
end
else
Utils.makeChr (chr, posX, posY, env)
:: Utils.makeCursor (posX, posY, env) :: acc
Utils.makeChr (chr, posX, posY, env) :: acc
in
build
( pos + 1

View File

@@ -270,8 +270,8 @@ struct
let
val acc =
if absIdx = cursorIdx then
Utils.makeCursor (posX, posY, env)
:: Utils.makeCursorOnChr (chr, posX, posY, env) :: acc
Utils.makeCursorOnChr (chr, posX, posY, env)
:: Utils.makeCursor (posX, posY, env) :: acc
else if Utils.isInSearchRange (absIdx, searchPos, env) then
Utils.makeHighlightChr (chr, posX, posY, env)
:: Utils.makeHighlight (posX, posY, env) :: acc