Skip to content

Commit

Permalink
Merge pull request XVimProject#1036 from tidbeck/issue/1012
Browse files Browse the repository at this point in the history
Ignore quotes for block motions
  • Loading branch information
JugglerShu authored Jan 28, 2017
2 parents 763aac7 + 99a0df3 commit 963ed2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions XVim/NSTextStorage+VimOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -1865,9 +1865,10 @@ NSRange xv_current_block(NSString *string, NSUInteger index, NSUInteger count, B

/*
* Search for matching ')', '}', etc.
* Put this position in curwin->w_cursor.
* Put this position in end_pos.
* Ignore quotes here.
*/
if ((end_pos = findmatchlimit(string, end_pos, other, NO)) == -1) {
if ((end_pos = findmatchlimit(string, end_pos, other, YES)) == -1) {
return NSMakeRange(NSNotFound, 0);
}
}
Expand Down
5 changes: 5 additions & 0 deletions XVim/Test/XVimTester+TextObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ - (NSArray*)textobject_testcases{
static NSString* text_object7 = @"hhh hhh hhh";
static NSString* text_object8 = @"iiiiIIIIiii";
static NSString* text_object9 = @"jjj_jjj_jjj";
static NSString* text_object10 = @"aaa(\"aaa\")aaa";


// Text object results with delete
Expand Down Expand Up @@ -53,6 +54,8 @@ - (NSArray*)textobject_testcases{
static NSString* text_object_i_result9 = @"jjj__jjj";
static NSString* text_object_i_result9_i = @"jjj_kkk_jjj";
static NSString* text_object_a_result9 = @"jjjjjj";
static NSString* text_object_i_result10 = @"aaa()aaa";
static NSString* text_object_i_result10_i = @"aaa(bbb)aaa";

// Text object results with yank
static NSString* text_object_yi_result0 = @"aaaaaa(aaa)aaa";
Expand All @@ -68,6 +71,7 @@ - (NSArray*)textobject_testcases{
XVimMakeTestCase(text_object0, 5, 0, @"dib", text_object_i_result0 , 4, 0),
XVimMakeTestCase(text_object0, 5, 0, @"dab", text_object_a_result0 , 3, 0),
XVimMakeTestCase(text_object0, 3, 0, @"di(", text_object_i_result0 , 4, 0), // begin on (
XVimMakeTestCase(text_object10, 3, 0, @"di(", text_object_i_result10 , 4, 0),

XVimMakeTestCase(text_object0, 5, 0, @"yi(0P", text_object_yi_result0 , 2, 0),
XVimMakeTestCase(text_object0, 5, 0, @"yi)0P", text_object_yi_result0 , 2, 0),
Expand Down Expand Up @@ -121,6 +125,7 @@ - (NSArray*)textobject_testcases{
// c ()
XVimMakeTestCase(text_object0, 5, 0, @"ci(bbb<ESC>", text_object_i_result0_i , 6, 0),
XVimMakeTestCase(text_object0, 5, 0, @"ci)bbb<ESC>", text_object_i_result0_i , 6, 0),
XVimMakeTestCase(text_object10, 5, 0, @"ci)bbb<ESC>", text_object_i_result10_i , 6, 0),

// c "
XVimMakeTestCase(text_object1, 5, 0, @"ci\"aaa<ESC>", text_object_i_result1_i , 6, 0),
Expand Down

0 comments on commit 963ed2b

Please sign in to comment.