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

Fix bug with appending an empty line after a partial line. It should add a...

Fix bug with appending an empty line after a partial line. It should add a blank line but it was a no-op. This made appendScreenToSCrollback push fewer lines than expected and popScrollbackLines would make a mess of things when called later. Also, empty lines would sometimes be missing from the scrollback buffer.
parent f63fa9d7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -118,7 +118,13 @@ static char* formatsct(screen_char_t* src, int len, char* dest) {
if (length > free_space) {
return NO;
}
if (is_partial) {
// There's a bit of an edge case here: if you're appending an empty
// non-partial line to a partial line, we need it to append a blank line
// after the continued line. In practice this happens because a line is
// long but then the wrapped portion is erased and the EOL_SOFT flag stays
// behind. It would be really complex to ensure consistency of line-wrapping
// flags because the screen contents are changed in so many places.
if (is_partial && !(!partial && length == 0)) {
// append to an existing line
NSAssert(cll_entries > 0, @"is_partial but has no entries");
cumulative_line_lengths[cll_entries - 1] += length;
Loading
Loading
Loading
Loading
@@ -226,3 +226,6 @@ NSString* ScreenCharArrayToString(screen_char_t* screenChars,
 
// Number of chars before a sequence of nuls at the end of the line.
int EffectiveLineLength(screen_char_t* theLine, int totalLength);
NSString* ScreenCharArrayToStringDebug(screen_char_t* screenChars,
int lineLength);
Loading
Loading
@@ -326,6 +326,18 @@ NSString* ScreenCharArrayToString(screen_char_t* screenChars,
freeWhenDone:NO] autorelease];
}
 
NSString* ScreenCharArrayToStringDebug(screen_char_t* screenChars,
int lineLength) {
NSMutableString* result = [NSMutableString stringWithCapacity:lineLength];
for (int i = 0; i < lineLength; ++i) {
unichar c = screenChars[i].code;
if (c != DWC_RIGHT) {
[result appendString:ScreenCharToStr(&screenChars[i])];
}
}
return result;
}
int EffectiveLineLength(screen_char_t* theLine, int totalLength) {
for (int i = totalLength-1; i >= 0; i--) {
if (theLine[i].complexChar || theLine[i].code) {
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