Skip to content

Commit

Permalink
fixes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
nosami committed May 2, 2017
1 parent a2fe9ca commit ea27f4d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions XSVim.Tests/Movement.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ module ``Movement tests`` =
let ``Move down to desired column``() =
assertText "12345$6\n123\n123456" "jj" "123456\n123\n12345$6"

[<Test>]
let ``Move down to last column``() =
assertText "12345$6\n123\n123456" "j" "123456\n123$\n123456"

[<Test>]
let ``Move ten right``() =
assertText "a$bcdefghijkl" "10l" "abcdefghijk$l"
2 changes: 1 addition & 1 deletion XSVim/Properties/AddinInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open MonoDevelop
[<assembly:Addin (
"XSVim",
Namespace = "XSVim",
Version = "0.16"
Version = "0.16.1"
)>]

[<assembly:AddinName ("Vim")>]
Expand Down
10 changes: 6 additions & 4 deletions XSVim/XSVim.fs
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,11 @@ module VimHelpers =
editor.CaretOffset,
if editor.CaretLine > DocumentLocation.MinLine then
let column =
if vimState.desiredColumn > editor.CaretColumn && vimState.desiredColumn <= editor.Length then
let line = editor.GetLine (editor.CaretLine - 1)
if vimState.desiredColumn > editor.CaretColumn && vimState.desiredColumn <= line.Length then
vimState.desiredColumn
else
editor.CaretColumn
line.Length

editor.LocationToOffset (new DocumentLocation(editor.CaretLine - 1, column))
else
Expand All @@ -241,10 +242,11 @@ module VimHelpers =
editor.CaretOffset,
if editor.CaretLine < editor.LineCount then
let column =
if vimState.desiredColumn > editor.CaretColumn && vimState.desiredColumn <= editor.Length then
let line = editor.GetLine (editor.CaretLine + 1)
if vimState.desiredColumn > editor.CaretColumn && vimState.desiredColumn <= line.Length then
vimState.desiredColumn
else
editor.CaretColumn
line.Length

editor.LocationToOffset (new DocumentLocation(editor.CaretLine + 1, column))
else
Expand Down

0 comments on commit ea27f4d

Please sign in to comment.