Skip to content

Commit

Permalink
Merge pull request #3113 from xconverge/fix-minor-ctrl-a-issue
Browse files Browse the repository at this point in the history
Minor C-a C-x fix
  • Loading branch information
xconverge authored Oct 7, 2018
2 parents d114b94 + c870a7a commit 75730da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3971,8 +3971,8 @@ abstract class IncrementDecrementNumberAction extends BaseCommand {

for (let { start, end, word } of Position.IterateWords(whereToStart)) {
// '-' doesn't count as a word, but is important to include in parsing
// the number
if (text[start.character - 1] === '-') {
// the number, as long as it is not just part of the word (-foo2 for example)
if (text[start.character - 1] === '-' && /\d/.test(text[start.character])) {
start = start.getLeft();
word = text[start.character] + word;
}
Expand Down
7 changes: 7 additions & 0 deletions test/mode/modeNormal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,13 @@ suite('Mode Normal', () => {
end: ['foo1bar|3'],
});

newTest({
title: 'can <C-a> on word with - in front of it',
start: ['-fo|o2'],
keysPressed: '<C-a>',
end: ['-foo|3'],
});

newTest({
title: 'can do Y',
start: ['|blah blah'],
Expand Down

0 comments on commit 75730da

Please sign in to comment.