Skip to content

Commit

Permalink
Bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
emsquared committed Jul 2, 2012
1 parent 8033d99 commit 98c91a4
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 26 deletions.
8 changes: 2 additions & 6 deletions Classes/Controllers/TXMasterController.m
Original file line number Diff line number Diff line change
Expand Up @@ -619,12 +619,8 @@ - (void)themeStyleDidChange:(NSNotification *)note
[sf appendString:TXTLS(@"ThemeChangeOverridePromptChannelFont")];
[sf appendString:NSStringNewlinePlaceholder];
}

if ([TPCPreferences rightToLeftFormatting]) {
[self.text setBaseWritingDirection:NSWritingDirectionRightToLeft];
} else {
[self.text setBaseWritingDirection:NSWritingDirectionLeftToRight];
}

[self.text updateTextDirection];

sf = (NSMutableString *)[sf trim];

Expand Down
2 changes: 1 addition & 1 deletion Classes/Headers/StaticDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
/* Miscellaneous functions to handle small tasks. */
#define CFItemRefToID(s) (id)s
#define BOOLReverseValue(b) ((b == YES) ? NO : YES)
#define BOOLValueFromObject(b) BOOLReverseValue(PointerIsEmpty(b))
#define BOOLValueFromObject(b) PointerIsNotEmpty(b)
#define NSDissimilarObjects(o,n) (o != n)

#define TEXTUAL_EXTERN __attribute__((visibility("default")))
Expand Down
2 changes: 2 additions & 0 deletions Classes/Headers/TVCInputTextField.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
@property (nonatomic, unsafe_unretained) SEL actionSelector;
@property (nonatomic, strong) NSAttributedString *placeholderString;

- (void)updateTextDirection;
- (void)resetTextFieldCellSize;

- (void)setReturnActionWithSelector:(SEL)selector owner:(id)owner;

- (TVCInputTextFieldBackground *)backgroundView;
Expand Down
6 changes: 3 additions & 3 deletions Classes/Helpers/Cocoa (Objective-C)/NSStringHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (NSString *)stringCharacterAtIndex:(NSInteger)index
return nil;
}

- (const UniChar*)getCharactersBuffer
- (const UniChar *)getCharactersBuffer
{
NSUInteger len = self.length;

Expand Down Expand Up @@ -579,7 +579,7 @@ - (NSString *)identFromHostmask
}
}

return @"";
return NSStringEmptyPlaceholder;
}

- (NSString *)hostFromHostmask
Expand All @@ -588,7 +588,7 @@ - (NSString *)hostFromHostmask
return [self safeSubstringAfterIndex:[self stringPosition:@"@"]];
}

return @"";
return NSStringEmptyPlaceholder;
}

- (NSString *)reservedCharactersToIRCFormatting
Expand Down
2 changes: 1 addition & 1 deletion Classes/IRC/IRCClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -2686,7 +2686,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString
{
NSString *command = [cmd lowercaseString];

NSArray *extensions = @[@".scpt", @".py", @".pyc", @".rb", @".pl", @".sh", @".bash", @""];
NSArray *extensions = @[@".scpt", @".py", @".pyc", @".rb", @".pl", @".sh", @".bash", NSStringEmptyPlaceholder];

#ifdef TXUserScriptsFolderAvailable
NSArray *scriptPaths = @[
Expand Down
4 changes: 3 additions & 1 deletion Classes/Library/TLOFileLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ - (void)open
{
[self close];

if ([TPCPreferences transcriptFolder] == nil) {
NSString *path = [TPCPreferences transcriptFolder];

if (NSObjectIsEmpty(path)) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/Library/TLOPopupPrompts.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ - (void)sheetWindowWithQuestion:(NSWindow *)window
{
BOOL useSupression = NO;

NSString *__suppressionKey = @"";
NSString *__suppressionKey = NSStringEmptyPlaceholder;

if (NSObjectIsNotEmpty(suppressKey)) {
__suppressionKey = [TXPopupPromptSuppressionPrefix stringByAppendingString:suppressKey];
Expand Down Expand Up @@ -106,7 +106,7 @@ + (BOOL)dialogWindowWithQuestion:(NSString *)bodyText
{
BOOL useSupression = NO;

NSString *__suppressKey = @"";
NSString *__suppressKey = NSStringEmptyPlaceholder;

if (NSObjectIsNotEmpty(suppressKey) && [suppressText isEqualToString:@"-"] == NO) {
__suppressKey = [TXPopupPromptSuppressionPrefix stringByAppendingString:suppressKey];
Expand Down
33 changes: 23 additions & 10 deletions Classes/Views/Input Text Field/TVCInputTextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ - (id)initWithCoder:(NSCoder *)coder
self.placeholderString = [NSAttributedString alloc];
self.placeholderString = [self.placeholderString initWithString:TXTLS(@"InputTextFieldPlaceholderValue") attributes:attrs];
}

return self;
}

Expand All @@ -53,6 +53,15 @@ - (TVCInputTextFieldBackground *)backgroundView
return (self.superview.superview.superview.subviews)[2];
}

- (void)updateTextDirection
{
if ([TPCPreferences rightToLeftFormatting]) {
[self setBaseWritingDirection:NSWritingDirectionRightToLeft];
} else {
[self setBaseWritingDirection:NSWritingDirectionLeftToRight];
}
}

- (void)resetTextFieldCellSize
{
BOOL drawBezel = YES;
Expand All @@ -76,19 +85,19 @@ - (void)resetTextFieldCellSize
if (NSObjectIsEmpty(stringv)) {
textBoxFrame.size.height = _InputBoxDefaultHeight;
backgroundFrame.size.height = _InputBoxBackgroundDefaultHeight;

if (_lastDrawnLineCount >= 2) {
drawBezel = YES;
}

_lastDrawnLineCount = 1;
} else {
NSInteger totalLinesBase = [self numberOfLines];

if (_lastDrawnLineCount == totalLinesBase) {
drawBezel = NO;
}

_lastDrawnLineCount = totalLinesBase;

if (drawBezel) {
Expand Down Expand Up @@ -139,16 +148,20 @@ - (void)textDidChange:(NSNotification *)aNotification
}

- (void)drawRect:(NSRect)dirtyRect
{
{
[self updateTextDirection];

if ([TPCPreferences useLogAntialiasing] == NO) {
[_NSGraphicsCurrentContext() saveGraphicsState];
[_NSGraphicsCurrentContext() setShouldAntialias: NO];
}

NSString *value = [self stringValue];

if (NSObjectIsEmpty(value) && NSDissimilarObjects([self baseWritingDirection], NSWritingDirectionRightToLeft)) {
[self.placeholderString drawAtPoint:NSMakePoint(6, 1)];
if (NSObjectIsEmpty(value)) {
if (NSDissimilarObjects([self baseWritingDirection], NSWritingDirectionRightToLeft)) {
[self.placeholderString drawAtPoint:NSMakePoint(6, 1)];
}
} else {
[super drawRect:dirtyRect];
}
Expand Down Expand Up @@ -198,7 +211,7 @@ - (void)setWindowIsActive:(BOOL)value
if (NSDissimilarObjects(value, self.windowIsActive)) {
_windowIsActive = value;
}

[self setNeedsDisplay:YES];
}

Expand All @@ -222,7 +235,7 @@ - (void)drawRect:(NSRect)dirtyRect

/* Black Outline. */
controlFrame = NSMakeRect(0.0, 1.0, cellBounds.size.width, (cellBounds.size.height - 1.0));

/* We force focused color during first run because we draw before
our window has finished coming to the front so the wrong color
is used for our border. */
Expand Down Expand Up @@ -252,7 +265,7 @@ - (void)drawRect:(NSRect)dirtyRect

[controlColor set];
[controlPath fill];

if (_finishedFirstDraw == NO) {
_finishedFirstDraw = YES;
}
Expand Down
4 changes: 2 additions & 2 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<key>TXBundleBuildCodeName</key>
<string>Turtle Soup</string>
<key>TXBundleBuildNumber</key>
<string>11736</string>
<string>11741</string>
<key>TXBundleBuildReference</key>
<string>2.1.1-219-g0edd990-appstore,llvm4.0</string>
<string>2.1.1p2-220-g8033d99-debug,llvm4.0</string>
</dict>
</plist>

0 comments on commit 98c91a4

Please sign in to comment.