From 1fa295e59969613c8ef9798293cc9b8708c8d6dc Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 25 May 2022 15:08:37 -0700 Subject: keep repeated cursor up/down motions from drifting left --- text.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/text.lua b/text.lua index 626e898..eba0d4b 100644 --- a/text.lua +++ b/text.lua @@ -1108,7 +1108,11 @@ function Text.nearest_cursor_pos(line, x) -- x includes left margin local currxmax = Text.cursor_x(line, curr+1) --? print('nearest', x, left, right, curr, currxmin, currxmax) if currxmin <= x and x < currxmax then - return curr + if x-currxmin < currxmax-x then + return curr + else + return curr+1 + end end if left >= right-1 then return right -- cgit 1.4.1-2-gfad0 > Soul of a tiny new machine. More thorough tests → More comprehensible and rewrite-friendly software → More resilient society.Kartik K. Agaram <vc@akkartik.com>
about summary refs log tree commit diff stats
path: root/subx/run
blob: 99de077791ce69f4281cf07de730d26fd8b338c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22