From 9d677d353abdb3d86e0829fedc8ad11275a2bfa6 Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 20 Sep 2023 22:33:37 +0200 Subject: lineedit: add missing begin() calls in prevHist/nextHist --- src/display/lineedit.nim | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/display') 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 = "" -- cgit