From e9899c2772d9bc4b6e27d4e4fd450c4f62d042ff Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Thu, 21 Nov 2024 07:26:23 +1100 Subject: fix cursor repositioning --- jterm.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'jterm.hs') 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 = -- cgit v1.2.3