clean up parenthesis highlighting

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@30805 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2010-06-22 00:20:46 +00:00
parent 1c0d8df3db
commit 85941fac98
4 changed files with 19 additions and 66 deletions

View file

@ -1,3 +1,10 @@
2010-06-22 Riccardo Mottola
* Modules/Editors/ProjectCenter/PCEditor.h
* Modules/Editors/ProjectCenter/PCEditor.m
* Modules/Editors/ProjectCenter/PCEditor+Document.m
Clean up parenthesis highlighting.
2010-06-15 Wolfgang Lux <wolfgang.lux@gmail.com>
* Framework/PCProject.m (-fileTypesForCategoryKey:): Add .dylib to

View file

@ -245,58 +245,6 @@ unsigned int FindDelimiterInString(NSString * string,
}
}
- (void)computeNewParenthesisNesting
{
NSRange selectedRange;
NSString * myString;
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"DontTrackNesting"])
{
return;
}
selectedRange = [textView selectedRange];
// make sure we un-highlight a previously highlit delimiter
[self unhighlightCharacter];
// if we have a character at the selected location, check
// to see if it is a delimiter character
myString = [textView string];
if (selectedRange.length <= 1 && [myString length] > selectedRange.location)
{
unichar c;
// we must initialize these explicitly in order to make
// gcc shut up about flow control
unichar oppositeDelimiter = 0;
BOOL searchBackwards = NO;
c = [myString characterAtIndex: selectedRange.location];
// if it is, search for the opposite delimiter in a range
// of at most 1000 characters around it in either forward
// or backward direction (depends on the kind of delimiter
// we're searching for).
if (CheckDelimiter(c, &oppositeDelimiter, &searchBackwards))
{
unsigned int result;
result = FindDelimiterInString(myString,
oppositeDelimiter,
c,
selectedRange.location,
searchBackwards);
// and in case a delimiter is found, highlight it
if (result != NSNotFound)
{
[self highlightCharacterAt: result];
}
}
}
}
// --- State
- (void)updateMiniwindowIconToEdited:(BOOL)flag

View file

@ -24,9 +24,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#ifndef _PCEditor_h_
#define _PCEditor_h_
#import <AppKit/AppKit.h>
#import <Protocols/CodeEditor.h>
@ -154,9 +151,6 @@
- (void)unhighlightCharacter;
- (void)highlightCharacterAt:(unsigned int)location;
- (void)computeNewParenthesisNesting;
- (void)computeNewParenthesisNesting: (NSTextView *)editorView;
@end
#endif // _PCEDITOR_H_

View file

@ -837,7 +837,11 @@
{
if (editorTextViewIsPressingKey == NO)
{
[self computeNewParenthesisNesting];
id object;
object = [notification object];
if (object == _intEditorView || object == _extEditorView)
[self computeNewParenthesisNesting: object];
}
}
@ -852,7 +856,8 @@
- (void)editorTextViewDidPressKey:sender
{
// NSLog(@"Did pressing key");
[self computeNewParenthesisNesting];
if (sender == _intEditorView || sender == _extEditorView)
[self computeNewParenthesisNesting: sender];
editorTextViewIsPressingKey = NO;
}
@ -1318,7 +1323,7 @@ unsigned int FindDelimiterInString(NSString * string,
}
}
- (void)computeNewParenthesisNesting
- (void)computeNewParenthesisNesting: (NSTextView *)editorView
{
NSRange selectedRange;
NSString *myString;
@ -1328,19 +1333,18 @@ unsigned int FindDelimiterInString(NSString * string,
return;
}
selectedRange = [_intEditorView selectedRange];
NSAssert(editorView, @"computeNewParenthesis: editorView is nil");
selectedRange = [editorView selectedRange];
// make sure we un-highlight a previously highlit delimiter
[self unhighlightCharacter];
// if we have a character at the selected location, check
// to see if it is a delimiter character
myString = [_intEditorView string];
myString = [editorView string];
if (selectedRange.length <= 1 && [myString length] > selectedRange.location)
{
unichar c;
// we must initialize these explicitly in order to make
// gcc shut up about flow control
unichar oppositeDelimiter = 0;
BOOL searchBackwards = NO;