diff options
author | bptato <nincsnevem662@gmail.com> | 2024-09-28 17:29:12 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-09-28 17:54:08 +0200 |
commit | 9c257361388f5007871a36eea3abc815a8740d66 (patch) | |
tree | 3c9494ecfa6467438043402594bb2d2b7bd262eb /src/local/lineedit.nim | |
parent | 1bbad9a452390ebc09d038e25ed0307f3fdcd312 (diff) | |
download | chawan-9c257361388f5007871a36eea3abc815a8740d66.tar.gz |
container: fix control char display
Also, kill twidth and its friends; we haven't been using it for a while now. (In the future, a solution with PUA chars might be worth exploring.)
Diffstat (limited to 'src/local/lineedit.nim')
-rw-r--r-- | src/local/lineedit.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/local/lineedit.nim b/src/local/lineedit.nim index 2f998b84..f64c37fd 100644 --- a/src/local/lineedit.nim +++ b/src/local/lineedit.nim @@ -26,9 +26,9 @@ type promptw: int state*: LineEditState escNext*: bool - cursorx: int # 0 ..< news.notwidth + cursorx: int # 0 ..< news.width cursori: int # 0 ..< news.len - shiftx: int # 0 ..< news.notwidth + shiftx: int # 0 ..< news.width shifti: int # 0 ..< news.len padding: int # 0 or 1 maxwidth: int @@ -127,7 +127,7 @@ proc insertCharseq(edit: LineEdit; s: string) = return edit.news.insert(s, edit.cursori) edit.cursori += s.len - edit.cursorx += s.notwidth() + edit.cursorx += s.width() edit.redraw = true proc cancel(edit: LineEdit) {.jsfunc.} = @@ -270,7 +270,7 @@ proc begin(edit: LineEdit) {.jsfunc.} = proc `end`(edit: LineEdit) {.jsfunc.} = if edit.cursori < edit.news.len: edit.cursori = edit.news.len - edit.cursorx = edit.news.notwidth() + edit.cursorx = edit.news.width() if edit.cursorx >= edit.shiftx + edit.maxwidth: edit.redraw = true @@ -315,7 +315,7 @@ proc readLine*(prompt, current: string; termwidth: int; disallowed: set[char]; hide: hide, redraw: true, cursori: current.len, - cursorx: current.notwidth(), + cursorx: current.width(), # - 1, so that the cursor always has place maxwidth: termwidth - promptw - 1, hist: hist, |