summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2024-11-21 07:26:23 +1100
committerJustin Bedo <cu@cua0.org>2024-11-21 09:34:49 +1100
commite9899c2772d9bc4b6e27d4e4fd450c4f62d042ff (patch)
tree3274c33860b504776256dc79ab7fd81371dbad6a
parentab2500d583c4855a32d7c3738e5df280ff111a68 (diff)
fix cursor repositioning
-rw-r--r--jterm.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/jterm.hs b/jterm.hs
index 98ac2ba..7790942 100644
--- a/jterm.hs
+++ b/jterm.hs
@@ -474,11 +474,10 @@ handleEvent display win bgcolour fgcolour linecolour selcolour font event = do
| otherwise = p
(cs, ce) = cursor b
c'
- | cs <= e && ce > e = (s + l, ce)
- | cs < s && ce >= s = (cs, s)
- | cs >= s && ce <= e = (s + l, s + l)
- | ce < s = (cs, ce)
- | otherwise = (cs + l + s - e, ce + l + s - e)
+ | e <= cs = (cs + l + s - e, ce + l + s - e)
+ | ce <= s = (cs, ce)
+ | ce <= e && cs >= s = (s + l, s + l)
+ | otherwise = (min cs ce, ce + s - e)
put $ b {content = doedit s e (content b) ins, cursor = c', ptycursor = if movepty then s + l else p'}
where
doedit s e rp ins =