Skip to content

Commit

Permalink
w skips over tabs correctly. Fixes #183
Browse files Browse the repository at this point in the history
  • Loading branch information
nosami committed Oct 7, 2017
1 parent b6c27e7 commit 65e0226
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions XSVim.Tests/Movement.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ module ``Movement tests`` =
let ``Moves to EOF when there is no next word``() =
assertText "aa$aa" "w" "aaaa$"

[<Test>]
let ``w skips over tabs``() =
assertText "\t$\t\taaaa" "w" "\t\t\ta$aaa"

[<Test>]
let ``Move to word end``() =
assertText "aa$a bbb" "e" "aaa$ bbb"
Expand Down
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.45.9"
Version = "0.45.10"
)>]

[<assembly:AddinName ("Vim")>]
Expand Down
3 changes: 2 additions & 1 deletion XSVim/XSVim.fs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ module VimHelpers =
let isWORDChar c = not (Char.IsWhiteSpace c)
let isNonBlankButNotWordChar c = isWORDChar c && not (isWordChar c)
let isEOLChar c = c = '\r' || c = '\n'
let isSpaceOrTab c = c = ' ' || c = '\t'

let (|WhiteSpace|_|) c =
if Char.IsWhiteSpace c then Some WhiteSpace else None
Expand All @@ -128,7 +129,7 @@ module VimHelpers =
| WhiteSpace, Move
| WhiteSpace, Delete ->
seq { index+1 .. editor.Length-1 }
|> Seq.tryFind(fun index -> not (editor.[index] = ' '))
|> Seq.tryFind(fun index -> not (isSpaceOrTab editor.[index]))
|> Option.bind(fun newIndex ->

let findFirstWordOnLine startOffset =
Expand Down

0 comments on commit 65e0226

Please sign in to comment.