diff --git a/XSVim.Tests/DeleteTests.fs b/XSVim.Tests/DeleteTests.fs index e9abe5c..38b1f49 100644 --- a/XSVim.Tests/DeleteTests.fs +++ b/XSVim.Tests/DeleteTests.fs @@ -63,6 +63,14 @@ $ bar let ``Delete char under caret``() = assertText "abc$def" "x" "abd$ef" + [] + let ``Delete char at EOL``() = + assertText "abcdef$\n" "xx" "abcd$\n" + + [] + let ``x with multiplier stops at EOL``() = + assertText "abcdef$" "4x" "abcde$" + [] let ``Delete char to left of caret``() = assertText "abc$def" "X" "ac$def" diff --git a/XSVim.Tests/XSVim.Tests.fsproj b/XSVim.Tests/XSVim.Tests.fsproj index 77a1960..b315915 100644 --- a/XSVim.Tests/XSVim.Tests.fsproj +++ b/XSVim.Tests/XSVim.Tests.fsproj @@ -60,9 +60,6 @@ - - ..\packages\FSharp.Core.4.3.4\lib\net45\FSharp.Core.dll - @@ -80,7 +77,6 @@ - {9DB313D4-4CD1-455F-846F-42CD234DE626} XSVim diff --git a/XSVim/Properties/AssemblyInfo.fs b/XSVim/Properties/AssemblyInfo.fs index ba44cef..1f3dae1 100644 --- a/XSVim/Properties/AssemblyInfo.fs +++ b/XSVim/Properties/AssemblyInfo.fs @@ -5,7 +5,7 @@ open System.Runtime.CompilerServices [] module AddinVersion = [] - let version = "0.54.1.1" + let version = "0.54.2" [] // The assembly version has the format {Major}.{Minor}.{Build}.{Revision} diff --git a/XSVim/XSVim.fs b/XSVim/XSVim.fs index e0180b8..7f04081 100755 --- a/XSVim/XSVim.fs +++ b/XSVim/XSVim.fs @@ -676,7 +676,7 @@ module Vim = let endLine = editor.GetLineByOffset endPos editor.SetSelection(startLine.Offset, endLine.EndOffsetIncludingDelimiter) if editor.SelectionMode = SelectionMode.Block then EditActions.ToggleBlockSelectionMode editor - | _ -> editor.SetSelection(start, finish) + | _ -> editor.SetSelection(start, min finish editor.Length) let (|MoveUpOrDown|_|) = function | { commandType=Move; textObject=Up } @@ -1213,7 +1213,28 @@ module Vim = |> Option.iter(fun token -> token.Cancel()) { vimState with insertModeCancellationTokenSource = None } | _ -> vimState - if count = 1 then newState else processCommands (count-1) newState command false + + match count with + | 1 -> newState + | _ -> + match command.commandType, command.textObject with + | Delete, CurrentLocation -> + // When the caret is at the end of the line, + // the multiplier should be ignored. + // As far as I can tell, this is an exception + // to the rule - x usually deletes the character + // at the caret and then moves right, + // unless the caret is at the EOL, in which case + // it deletes and then moves to the left. + let offset = min (editor.Length-1) (editor.CaretOffset+1) + let charAtCaret = editor.[offset] + + if not (isEOLChar charAtCaret) then + processCommands (count-1) newState command false + else + // stop repeating + newState + | _ -> processCommands (count-1) newState command false let count = command.repeat |> Option.defaultValue 1 processCommands count vimState command true