Permalink
Browse files

Bugfix and removed logging.

  • Loading branch information...
weaksauce committed May 7, 2012
1 parent bf2ab37 commit eb03be326499125d67153df73ffcfc5ad53f35af
Showing with 4 additions and 24 deletions.
  1. +4 −24 XVim/XVimSourceView+Vim.m
View
@@ -96,7 +96,6 @@ - (BOOL) isLastCharacter:(NSUInteger)index{
* Determine if the position specified with "index" is EOL.
**/
- (BOOL) isEOL:(NSUInteger)index{
- TRACE_LOG(@"%u", index);
ASSERT_VALID_RANGE_WITH_EOF(index);
return [self isEOF:index] == NO && [self isNewLine:index] == NO && [self isNewLine:index+1];
}
@@ -596,14 +595,6 @@ - (NSUInteger)nextLine:(NSUInteger)index column:(NSUInteger)column count:(NSUInt
}
return pos;
}
-void logchar(unichar x, NSString* s);
-void logchar(unichar x, NSString* s){
- TRACE_LOG(@"%@ character: %c", s, x);
- TRACE_LOG(@"iswhitespace() = %d", isWhiteSpace(x));
- TRACE_LOG(@"isnewline() = %d", isNewLine(x));
- TRACE_LOG(@"isNonBlank() = %d", isNonBlank(x));
- TRACE_LOG(@"isKeyword() = %d", isKeyword(x));
-}
/**
From Vim help: word and WORD
@@ -627,7 +618,7 @@ void logchar(unichar x, NSString* s){
**/
/**
- * Returns position of next head of word.
+ * Returns position of the head of count words forward and an info structure that handles the end of word boundaries.
* @param index
* @param count
* @param option MOTION_OPTION_NONE or BIGWORD
@@ -651,7 +642,6 @@ - (NSUInteger)wordsForward:(NSUInteger)index count:(NSUInteger)count option:(MOT
BOOL inWord = isNonBlank(lastChar);
BOOL newLineStarts = isNewLine(lastChar);
BOOL foundNonBlanks = inWord;
- TRACE_LOG(@"starting conditions: inword: %d, Newline: %d", inWord, newLineStarts);
for(NSUInteger i = index+1 ; i <= [[self string] length]; i++ ){
// Each time we encounter new word decrement "counter".
// Remember blankline is a word
@@ -670,36 +660,31 @@ - (NSUInteger)wordsForward:(NSUInteger)index count:(NSUInteger)count option:(MOT
if(newLineStarts){
if(isNewLine(curChar)){
//two newlines in a row.
- TRACE_LOG(@"newline to newline");
inWord = FALSE;
- if(info->findEndOfWord){
+ if(!info->findEndOfWord){
--count;
- info->lastEndOfWord = i;
- info->lastEndOfLine = i;
+ info->lastEndOfWord = i-1;
+ info->lastEndOfLine = i-1;
}
}else if(isNonBlank(curChar)){
- TRACE_LOG(@"newline to nonblank");
inWord = TRUE;
--count;
newLineStarts = FALSE;
info->isFirstWordInALine = FALSE;
}else {
- TRACE_LOG(@"newline to blank");
inWord = FALSE;
newLineStarts = FALSE;
info->isFirstWordInALine = FALSE;
}
}else if(inWord){
if(isNewLine(curChar)){
- TRACE_LOG(@"inword to newline");
//from word to newline
newLineStarts = TRUE;
inWord = FALSE;
foundNonBlanks = FALSE;
info->lastEndOfLine = i-1;
info->lastEndOfWord = i-1;
}else if(isNonBlank(curChar)){
- TRACE_LOG(@"inword to non blank: %d, %c", [str characterAtIndex:i], [str characterAtIndex:i] );
inWord = TRUE;
newLineStarts = FALSE;
if(isKeyword(lastChar) != isKeyword(curChar) && opt != BIGWORD){
@@ -708,7 +693,6 @@ - (NSUInteger)wordsForward:(NSUInteger)index count:(NSUInteger)count option:(MOT
info->lastEndOfWord = i-1;
}
}else if(!isNonBlank(curChar)){
- TRACE_LOG(@"inword to blank");
newLineStarts = FALSE;
inWord = FALSE;
info->lastEndOfLine = i-1;
@@ -717,15 +701,12 @@ - (NSUInteger)wordsForward:(NSUInteger)index count:(NSUInteger)count option:(MOT
}else { //on a blank character that is not a newline
if(isNewLine(curChar)){
//not in word
- TRACE_LOG(@"foundNEWLINE");
newLineStarts = TRUE;
info->isFirstWordInALine = TRUE;
info->lastEndOfLine = info->lastEndOfWord;
inWord = FALSE;
}else if(isNonBlank(curChar)){
- TRACE_LOG(@"not inword and not blank");
// blank to word boundary.
- logchar(curChar, @"curchar");
inWord = TRUE;
newLineStarts = FALSE;
--count;
@@ -742,7 +723,6 @@ - (NSUInteger)wordsForward:(NSUInteger)index count:(NSUInteger)count option:(MOT
}
if( 0 == count ){
- TRACE_LOG(@"i = %d", i);
pos = i;
break;
}

0 comments on commit eb03be3

Please sign in to comment.