diff options
author | bptato <nincsnevem662@gmail.com> | 2024-05-23 17:42:40 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-05-23 17:45:39 +0200 |
commit | 444a7084e7cb0b458c5cee47283b46ad0f38a959 (patch) | |
tree | b4cfd9ae784fd81c1294afdda5b7ec92838328c1 /src/local/client.nim | |
parent | 8c7a2a582baff30ccbf76f52b6b48cc979ea62e2 (diff) | |
download | chawan-444a7084e7cb0b458c5cee47283b46ad0f38a959.tar.gz |
client: fix double click on double width chars
This is not a perfect solution, but it's still better than not being able to double click on CJK links correctly.
Diffstat (limited to 'src/local/client.nim')
-rw-r--r-- | src/local/client.nim | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/local/client.nim b/src/local/client.nim index 19c31263..a14ce63c 100644 --- a/src/local/client.nim +++ b/src/local/client.nim @@ -262,15 +262,15 @@ proc handleCommandInput(client: Client; c: char): EmptyPromise = of mitPress: client.pressed = (input.col, input.row) of mitRelease: - #TODO this does not work very well with double width chars, - # because pressed could be equivalent to two separate cells if client.pressed == (input.col, input.row): - if input.col == container.acursorx and - input.row == container.acursory: + let prevx = container.cursorx + let prevy = container.cursory + #TODO I wish we could avoid setCursorXY if we're just going to + # click, but that doesn't work with double-width chars + container.setCursorXY(container.fromx + input.col, + container.fromy + input.row) + if container.cursorx == prevx and container.cursory == prevy: container.click() - else: - container.setCursorXY(container.fromx + input.col, - container.fromy + input.row) else: let diff = (input.col - client.pressed.col, input.row - client.pressed.row) |