diff options
author | bptato <nincsnevem662@gmail.com> | 2023-12-09 20:45:59 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-12-09 20:46:52 +0100 |
commit | 4ee1a937fad792654277a1eedd35bd0c4f8389c6 (patch) | |
tree | 902128394320b4c666d5bac73df64aa89092f5d6 /src/local/client.nim | |
parent | 4aa3e24199f0aac97d5541adcbf1ae137f7b64f0 (diff) | |
download | chawan-4ee1a937fad792654277a1eedd35bd0c4f8389c6.tar.gz |
pager: add marks
Default is vi-style, but w3m-style marks work as well; see bonus/w3m.toml.
Diffstat (limited to 'src/local/client.nim')
-rw-r--r-- | src/local/client.nim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/local/client.nim b/src/local/client.nim index 51055472..f9b6d9a3 100644 --- a/src/local/client.nim +++ b/src/local/client.nim @@ -7,6 +7,7 @@ import streams import strutils import tables import terminal +import unicode when defined(posix): import posix @@ -235,6 +236,7 @@ proc handleCommandInput(client: Client, c: char): EmptyPromise = proc input(client: Client): EmptyPromise = var p: EmptyPromise = nil client.pager.term.restoreStdin() + var buf: string while true: let c = client.readChar() if client.pager.askpromise != nil: @@ -242,6 +244,11 @@ proc input(client: Client): EmptyPromise = client.pager.fulfillAsk(true) elif c == 'n': client.pager.fulfillAsk(false) + elif client.pager.askcharpromise != nil: + buf &= c + if buf.validateUtf8() != -1: + continue + client.pager.fulfillCharAsk(buf) elif client.pager.lineedit.isSome: client.pager.inputBuffer &= c let edit = client.pager.lineedit.get |