Skip to content

Commit

Permalink
'A' should put caret at EOF on last line. Fixes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
nosami committed May 3, 2017
1 parent 0186aa5 commit 74deefb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions XSVim.Tests/MiscTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module ``Miscellaneous tests`` =
let ``'A' should put caret at end of the line``() =
assertText "abc$def\n" "A" "abcdef|\n"

[<Test>]
let ``'A' should put caret at EOF``() =
assertText "abc$def" "A" "abcdef|"

[<Test>]
let ``'a' should append after``() =
assertText "a$bcdef" "a" "a|bcdef"
Expand Down
7 changes: 6 additions & 1 deletion XSVim/XSVim.fs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,12 @@ module VimHelpers =
else
editor.CaretOffset
| EndOfLine -> editor.CaretOffset, line.EndOffset-1
| EndOfLineIncludingDelimiter -> editor.CaretOffset, line.EndOffsetIncludingDelimiter-1
| EndOfLineIncludingDelimiter ->
editor.CaretOffset,
if line.EndOffset = line.EndOffsetIncludingDelimiter then
line.EndOffsetIncludingDelimiter
else
line.EndOffsetIncludingDelimiter-1
| StartOfLine -> editor.CaretOffset, line.Offset
| StartOfLineNumber lineNumber ->
let line = editor.GetLine lineNumber
Expand Down

0 comments on commit 74deefb

Please sign in to comment.