Skip to content
Snippets Groups Projects
Commit c6408715 authored by George Nachman's avatar George Nachman
Browse files

Fix some warnings, minor code cleanup.

parent 66adce9d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1709,7 +1709,8 @@
- (void)closeTabClick:(id)sender
{
NSTabViewItem *item = [sender representedObject];
[sender retain];
[[sender retain] autorelease];
[[item retain] autorelease];
if(([_cells count] == 1) && (![self canCloseOnlyTab]))
return;
 
Loading
Loading
@@ -1721,13 +1722,9 @@
}
}
 
[item retain];
if(([self delegate]) && ([[self delegate] respondsToSelector:@selector(closeTab:)])){
[[self delegate] closeTab:[item identifier]];
}
[item release];
[sender release];
}
 
- (void)tabClick:(id)sender
Loading
Loading
Loading
Loading
@@ -3315,12 +3315,15 @@ static long long timeInTenthsOfSeconds(struct timeval t)
 
- (void)addNoteAtCursor {
PTYNoteViewController *note = [[[PTYNoteViewController alloc] init] autorelease];
VT100GridCoordRange rangeAtCursor = [self smartSelectionRangeAt:VT100GridCoordMake(SCREEN.cursorX - 1,
SCREEN.cursorY - 1)];
VT100GridCoordRange rangeBeforeCursor = [self smartSelectionRangeAt:VT100GridCoordMake(SCREEN.cursorX - 2,
SCREEN.cursorY - 1)];
VT100GridCoordRange rangeAfterCursor = [self smartSelectionRangeAt:VT100GridCoordMake(SCREEN.cursorX,
SCREEN.cursorY - 1)];
VT100GridCoordRange rangeAtCursor =
[self smartSelectionRangeAt:VT100GridCoordMake(SCREEN.cursorX - 1,
SCREEN.cursorY - 1)];
VT100GridCoordRange rangeBeforeCursor =
[self smartSelectionRangeAt:VT100GridCoordMake(SCREEN.cursorX - 2,
SCREEN.cursorY - 1)];
VT100GridCoordRange rangeAfterCursor =
[self smartSelectionRangeAt:VT100GridCoordMake(SCREEN.cursorX,
SCREEN.cursorY - 1)];
if (VT100GridCoordRangeLength(rangeAtCursor, SCREEN.width) > 0) {
[SCREEN addNote:note inRange:rangeAtCursor];
} else if (VT100GridCoordRangeLength(rangeAfterCursor, SCREEN.width) > 0) {
Loading
Loading
@@ -3335,10 +3338,11 @@ static long long timeInTenthsOfSeconds(struct timeval t)
}
 
- (void)showHideNotes {
VT100GridCoordRange range = VT100GridCoordRangeMake(0,
0,
SCREEN.width,
SCREEN.height + [SCREEN numberOfScrollbackLines]);
VT100GridCoordRange range =
VT100GridCoordRangeMake(0,
0,
SCREEN.width,
SCREEN.height + [SCREEN numberOfScrollbackLines]);
NSArray *notes = [SCREEN notesInRange:range];
BOOL anyNoteIsVisible = NO;
for (PTYNoteViewController *note in notes) {
Loading
Loading
Loading
Loading
@@ -4565,16 +4565,16 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
{
VT100GridCoordRange result = range;
int width = [dataSource width];
screen_char_t *line = nil;
int lineY = -1;
int lineY = result.start.y;
screen_char_t *line = [dataSource getLineAtIndex:lineY];
while (!VT100GridCoordEquals(result.start, range.end)) {
if (lineY != result.start.y) {
lineY = result.start.y;
line = [dataSource getLineAtIndex:lineY];
}
unichar code = line[result.start.x].code;
BOOL trim = (code == 0);
trim = trim || (trimSpaces && (code == ' ' || code == '\t' || code == TAB_FILLER));
BOOL trim = ((code == 0) ||
(trimSpaces && (code == ' ' || code == '\t' || code == TAB_FILLER)));
if (trim) {
result.start.x++;
if (result.start.x == width) {
Loading
Loading
@@ -4599,9 +4599,9 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
line = [dataSource getLineAtIndex:y];
}
unichar code = line[x].code;
BOOL trim = (code == 0);
trim = trim || (trimSpaces && (code == ' ' || code == '\t' || code == TAB_FILLER));
if (line[x].code == 0) {
BOOL trim = ((code == 0) ||
(trimSpaces && (code == ' ' || code == '\t' || code == TAB_FILLER)));
if (trim) {
result.end = VT100GridCoordMake(x, y);
} else {
break;
Loading
Loading
/* Bugs found during testing
- Cmd-I>terminal>put cursor in "scrollback lines", close window. It goes from 100000 to 100.
- Attach to tmux that's running vimdiff. Open a new tmux tab, grow the window, and close the tab. vimdiff's display is messed up.
- Save/restore alt screen in tmux is broken. Test that it's restored correctly, and that cursor position is also loaded properly on connecting.
*/
#import "VT100Screen.h"
 
#import "DebugLogging.h"
Loading
Loading
Loading
Loading
@@ -44,9 +44,9 @@ static void RunTestsInObject(iTermTest *test) {
}
 
int main(int argc, const char * argv[]) {
RunTestsInObject([VT100GridTest new]);
RunTestsInObject([VT100ScreenTest new]);
RunTestsInObject([IntervalTreeTest new]);
RunTestsInObject([[VT100GridTest new] autorelease]);
RunTestsInObject([[VT100ScreenTest new] autorelease]);
RunTestsInObject([[IntervalTreeTest new] autorelease]);
NSLog(@"All tests passed");
return 0;
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment