about summary refs log tree commit diff stats
path: root/src/display
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-20 22:33:37 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-20 22:33:37 +0200
commit9d677d353abdb3d86e0829fedc8ad11275a2bfa6 (patch)
tree4c5e3b26ce5a3850e196667b562714e67cf6e8a9 /src/display
parent225ab0ec3d4bb6cb764ccb5a97e8e5ce1f77e50b (diff)
downloadchawan-9d677d353abdb3d86e0829fedc8ad11275a2bfa6.tar.gz
lineedit: add missing begin() calls in prevHist/nextHist
Diffstat (limited to 'src/display')
-rw-r--r--src/display/lineedit.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/display/lineedit.nim b/src/display/lineedit.nim
index bcca28fe..595b98d3 100644
--- a/src/display/lineedit.nim
+++ b/src/display/lineedit.nim
@@ -284,6 +284,9 @@ proc prevHist(edit: LineEdit) {.jsfunc.} =
       edit.histtmp = $edit.news
     dec edit.histindex
     edit.news = edit.hist.lines[edit.histindex]
+    # The begin call is needed so the cursor doesn't get lost outside
+    # the string.
+    edit.begin()
     edit.end()
     edit.invalid = true
 
@@ -291,11 +294,13 @@ proc nextHist(edit: LineEdit) {.jsfunc.} =
   if edit.histindex + 1 < edit.hist.lines.len:
     inc edit.histindex
     edit.news = edit.hist.lines[edit.histindex]
+    edit.begin()
     edit.end()
     edit.invalid = true
   elif edit.histindex < edit.hist.lines.len:
     inc edit.histindex
     edit.news = edit.histtmp
+    edit.begin()
     edit.end()
     edit.histtmp = ""