Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  UUID for Xcode 8.2
  Fix XVimProject#675 and XVimProject#1004
  Ignore quotes for block motions
  Add UUID of Xcode 8.1 (8B62)
  normal mode playground cursor enabled
  Fix substeps
  • Loading branch information
JugglerShu committed Jan 28, 2017
2 parents 899315e + c17e148 commit d151997
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 deletions.
6 changes: 3 additions & 3 deletions INSTALL_Xcode8.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Since Apple decided not to load 3rd party plugins, we have to make change to it.

If you already have a certificate from Apple's developer program you can use it (so skip to next section now). If you don't have one or don't want to use the existing certificate create new one as follows.

1.1 Open "Keychain Access" (in Applications -> Utilities) and select "login" in the left pane.
2.1 Open "Keychain Access" (in Applications -> Utilities) and select "login" in the left pane.

1.2 Select Create a Certificate ( in KeyChain Access -> Certificate Assistant )
2.2 Select Create a Certificate ( in KeyChain Access -> Certificate Assistant )

![Keychaing1](Documents/Images/Keychain1.png)

1.3 Input your name (whatever you like) and select "Code Signing" for Certificate Type.
2.3 Input your name (whatever you like) and select "Code Signing" for Certificate Type.
Not required but the name is used later in a command line so it could be better to use easily distinguishable name here (I use XcodeSigner here).

![Keychaing2](Documents/Images/Keychain2.png)
Expand Down
24 changes: 24 additions & 0 deletions XVim/DVTSourceTextView+XVim.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ - (void)xvim_drawRect:(NSRect)dirtyRect{
return;
}

- (BOOL)isIDEPlaygroundSourceTextView
{
return [self isMemberOfClass:NSClassFromString(@"IDEPlaygroundTextView")];
}

// Drawing Caret
- (void)xvim__drawInsertionPointInRect:(NSRect)aRect color:(NSColor*)aColor{
// TRACE_LOG(@"%f %f %f %f", aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height);
Expand All @@ -202,6 +207,20 @@ - (void)xvim__drawInsertionPointInRect:(NSRect)aRect color:(NSColor*)aColor{
return [self xvim__drawInsertionPointInRect:aRect color:aColor];
}

if ([self isIDEPlaygroundSourceTextView]){
// Copypasta from pebble8888/XVim, Huge thanks to pebble8888!!
// Here's the link to the commit:
// https://github.com/pebble8888/XVim/commit/e27a614f6b59534b934ddeecba4c7355f34d4057
// Playground code
NSGraphicsContext* context = [NSGraphicsContext currentContext];
[context saveGraphicsState];
NSUInteger glyphIndex = [self insertionPoint];
NSRect glyphRect = [self xvim_boundingRectForGlyphIndex:glyphIndex];
[window drawInsertionPointInRect:glyphRect color:aColor];
[context restoreGraphicsState];
return;
}

// Erase old cursor.
// [self xvim_drawRect:s_lastCaret];

Expand All @@ -227,6 +246,11 @@ - (void)xvim_drawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turned
return [self xvim_drawInsertionPointInRect:rect color:color turnedOn:flag];
}

if ([self isIDEPlaygroundSourceTextView]) {
[self _drawInsertionPointInRect:NSZeroRect color:[NSColor grayColor]];
return;
}

/*
BOOL shouldClear = NO;
BOOL shouldDraw = NO;
Expand Down
2 changes: 2 additions & 0 deletions XVim/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<string>F41BD31E-2683-44B8-AE7F-5F09E919790E</string>
<string>E71C2CFE-BFD8-4044-8F06-00AE685A406C</string>
<string>8A66E736-A720-4B3C-92F1-33D9962C69DF</string>
<string>DA4FDFD8-C509-4D8B-8B55-84A7B66AE701</string>
<string>E0A62D1F-3C18-4D74-BFE5-A4167D643966</string>
</array>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 JugglerShu.Net. All rights reserved.</string>
Expand Down
7 changes: 4 additions & 3 deletions XVim/NSTextStorage+VimOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ - (NSUInteger)xvim_firstOfLine:(NSUInteger)index
return NSNotFound;
}

if (pos == index && isNewline([self.xvim_string characterAtIndex:(pos - 1)])) {
if (pos == index && isNewline([self.xvim_string characterAtIndex:(pos)])) {
return NSNotFound;
}
return pos;
Expand Down 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: 1 addition & 4 deletions XVim/NSTextView+VimOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -1432,10 +1432,7 @@ - (void)xvim_insertNewlineAboveCurrentLine{
}

- (void)xvim_insertNewlineAboveCurrentLineWithIndent{
NSUInteger head = [self.textStorage xvim_firstOfLine:self.insertionPoint];
if( NSNotFound == head ){
head = self.insertionPoint;
}
NSUInteger head = [self.textStorage xvim_startOfLine:self.insertionPoint];
if( 0 != head ){
[self setSelectedRange:NSMakeRange(head-1,0)];
[self insertNewline:self];
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 d151997

Please sign in to comment.