Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed bug in wordBackword which prevented from moving all the way to …

…the top of the buffer
  • Loading branch information...
commit a25a23f7cfaf27e4ba5dc4b53946dc13f50399a7 1 parent 1118ee4
@michaelfeathers authored
Showing with 1 addition and 2 deletions.
  1. +1 −2  editbuffer.hs
View
3  editbuffer.hs
@@ -54,7 +54,6 @@ replaceChar replacementChar buffer@(EditBuffer topLine location contents) =
f (ch, pos) = if pos == (absPosition buffer) then replacementChar else ch
in EditBuffer topLine location newContents
-
insertLineAfter :: EditBuffer -> EditBuffer
insertLineAfter (EditBuffer topLine _ "") = EditBuffer topLine (0,1) "\n"
insertLineAfter (EditBuffer topLine (_,y) contents) = EditBuffer topLine (0,y+1) newContents
@@ -98,7 +97,7 @@ wordForward buffer@(EditBuffer topLine _ contents) =
wordBackward :: EditBuffer -> EditBuffer
wordBackward buffer@(EditBuffer topLine _ contents) =
case dropWord . dropSpaces . reverse . take (absPosition buffer) . numberedElements $ contents of
- [] -> buffer
+ [] -> EditBuffer topLine (locationFromPosition 0 contents) contents
((_,pos) : _) -> EditBuffer topLine (locationFromPosition (pos+1) contents) contents
frame :: EditBuffer -> EditBuffer
Please sign in to comment.
Something went wrong with that request. Please try again.