Improve editor cursor placement with moveCursorClosest from text-zipper 0.12

This commit is contained in:
Jonathan Daugherty 2022-07-09 08:40:04 -07:00
parent 8eb41ca8c3
commit c832aef14a
2 changed files with 2 additions and 2 deletions

View File

@ -128,7 +128,7 @@ library
contravariant,
stm >= 2.4.3,
text,
text-zipper >= 0.11,
text-zipper >= 0.12,
template-haskell,
deepseq >= 1.3 && < 1.5,
unix,

View File

@ -125,7 +125,7 @@ handleEditorEvent e ed = return $ applyEdit f ed
VtyEvent ev ->
handleVtyEvent ev
MouseDown n _ _ (Location pos) | n == getName ed ->
Z.moveCursor (swap pos)
Z.moveCursorClosest (swap pos)
_ -> id
handleVtyEvent ev = case ev of
EvPaste bs -> case decodeUtf8 bs of