Skip to content

Commit 362bb7d

Browse files
Exact arithmetic for relative jumps.
1 parent 292bfd7 commit 362bb7d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Core.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ jump :: Int -> IO ()
324324
jump = jumpFn . const
325325

326326
-- | Jump to relative place, 0 to 1.
327-
jumpRel :: Float -> IO ()
327+
jumpRel :: Rational -> IO ()
328328
jumpRel r | r < 0 || r >= 1 = pure ()
329329
| True = modifyHS_ $ \st ->
330330
st { cursor = floor $ fromIntegral (size st) * r }

Keymap.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ mainMode = KeyMap \c -> getsHS modal >>= \case
6565
| c `elem` ['H', ';'] ->
6666
showHist $> mainMode
6767
| c >= '1' && c <= '9' ->
68-
jumpRel (0.1 * fromIntegral (fromEnum c - 48)) $> mainMode
68+
jumpRel (fromIntegral (fromEnum c - 48) / 10) $> mainMode
6969
| True -> sequence_ (M.lookup c keyMap) $> mainMode
7070

7171

0 commit comments

Comments
 (0)