diff options
author | Justin Bedo <cu@cua0.org> | 2024-11-21 07:26:23 +1100 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2024-11-21 09:34:49 +1100 |
commit | e9899c2772d9bc4b6e27d4e4fd450c4f62d042ff (patch) | |
tree | 3274c33860b504776256dc79ab7fd81371dbad6a | |
parent | ab2500d583c4855a32d7c3738e5df280ff111a68 (diff) |
fix cursor repositioning
-rw-r--r-- | jterm.hs | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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 = |