mirror of
https://github.com/textmate/textmate.git
synced 2026-01-20 20:27:59 -05:00
Change status bar’s “caret” property
We now use a selection string so status bar doesn’t need to know about what it actually contains.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
@interface OTVStatusBar : OakGradientView
|
||||
- (void)showBundlesMenu:(id)sender;
|
||||
- (void)setCaretPosition:(std::string const&)range;
|
||||
@property (nonatomic) NSString* selectionString;
|
||||
@property (nonatomic) NSString* grammarName;
|
||||
@property (nonatomic) NSString* symbolName;
|
||||
@property (nonatomic) BOOL isMacroRecording;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#import <OakFoundation/NSString Additions.h>
|
||||
#import <bundles/bundles.h>
|
||||
#import <text/ctype.h>
|
||||
#import <text/types.h>
|
||||
|
||||
static NSTextField* OakCreateTextField (NSString* label)
|
||||
{
|
||||
@@ -59,9 +58,6 @@ static NSImageView* OakCreateImageView (NSImage* image)
|
||||
}
|
||||
|
||||
@interface OTVStatusBar () <NSMenuDelegate>
|
||||
{
|
||||
text::range_t caretPosition;
|
||||
}
|
||||
@property (nonatomic) CGFloat recordingTime;
|
||||
@property (nonatomic) NSTimer* recordingTimer;
|
||||
|
||||
@@ -235,6 +231,14 @@ static NSImageView* OakCreateImageView (NSImage* image)
|
||||
// = Properties =
|
||||
// ==============
|
||||
|
||||
- (void)setSelectionString:(NSString*)newSelectionString
|
||||
{
|
||||
if(_selectionString == newSelectionString || [_selectionString isEqualToString:newSelectionString])
|
||||
return;
|
||||
_selectionString = newSelectionString;
|
||||
self.selectionField.stringValue = newSelectionString;
|
||||
}
|
||||
|
||||
- (void)setGrammarName:(NSString*)newGrammarName
|
||||
{
|
||||
if(_grammarName == newGrammarName || [_grammarName isEqualToString:newGrammarName])
|
||||
@@ -275,12 +279,6 @@ static NSImageView* OakCreateImageView (NSImage* image)
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setCaretPosition:(std::string const&)range
|
||||
{
|
||||
caretPosition = range;
|
||||
self.selectionField.stringValue = [NSString stringWithCxxString:range];
|
||||
}
|
||||
|
||||
- (void)updateTabSettings
|
||||
{
|
||||
self.tabSizePopUp.title = [NSString stringWithFormat:@"%@:\u2003%d", _softTabs ? @"Soft Tabs" : @"Tab Size", _tabSize];
|
||||
|
||||
@@ -234,13 +234,13 @@ private:
|
||||
|
||||
if([aKeyPath isEqualToString:@"selectionString"])
|
||||
{
|
||||
char const* str = [[textView valueForKey:@"selectionString"] UTF8String] ?: "1";
|
||||
[gutterView setHighlightedRange:str];
|
||||
[statusBar setCaretPosition:str];
|
||||
_symbolChooser.selectionString = textView.selectionString;
|
||||
NSString* str = [textView valueForKey:@"selectionString"];
|
||||
[gutterView setHighlightedRange:to_s(str ?: @"1")];
|
||||
[statusBar setSelectionString:str];
|
||||
_symbolChooser.selectionString = str;
|
||||
|
||||
ng::buffer_t const& buf = document->buffer();
|
||||
text::selection_t sel([textView.selectionString UTF8String]);
|
||||
text::selection_t sel(to_s(str));
|
||||
size_t i = buf.convert(sel.last().max());
|
||||
statusBar.symbolName = [NSString stringWithCxxString:buf.symbol_at(i)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user