diff --git a/src/apps/terminal/BasicTerminalBuffer.cpp b/src/apps/terminal/BasicTerminalBuffer.cpp index b3783e8224..d4088baf02 100644 --- a/src/apps/terminal/BasicTerminalBuffer.cpp +++ b/src/apps/terminal/BasicTerminalBuffer.cpp @@ -663,11 +663,18 @@ BasicTerminalBuffer::InsertTab() fSoftWrappedCursor = false; for (x = fCursor.x + 1; x < fWidth && !fTabStops[x]; x++) - ; // no body + ; x = restrict_value(x, 0, fWidth - 1); if (x != fCursor.x) { + TerminalLine* line = _LineAt(fCursor.y); + for (int32 i = fCursor.x; i <= x; i++) { + line->cells[i].character = ' '; + line->cells[i].attributes = line->cells[fCursor.x - 1].attributes; + } fCursor.x = x; + if (line->length < fCursor.x) + line->length = fCursor.x; _CursorChanged(); } } @@ -705,7 +712,7 @@ BasicTerminalBuffer::InsertSpace(int32 num) TerminalLine* line = _LineAt(fCursor.y); for (int32 i = fCursor.x; i < fCursor.x + num; i++) { line->cells[i].character = kSpaceChar; - line->cells[i].attributes = 0; + line->cells[i].attributes = line->cells[fCursor.x - 1].attributes; } _Invalidate(fCursor.y, fCursor.y); diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index e9e9ec4f8b..1c8d95c7e3 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -1112,12 +1112,8 @@ TermView::_DrawLinePart(int32 x1, int32 y1, uint32 attr, char *buf, // color attribute int forecolor = IS_FORECOLOR(attr); int backcolor = IS_BACKCOLOR(attr); - - // if (IS_FORESET(attr)) - rgb_fore = kTermColorTable[forecolor]; - - // if (IS_BACKSET(attr)) - rgb_back = kTermColorTable[backcolor]; + rgb_fore = kTermColorTable[forecolor]; + rgb_back = kTermColorTable[backcolor]; // Selection check. if (cursor) { @@ -1373,9 +1369,9 @@ TermView::Draw(BRect updateRect) rect.bottom = rect.top + fFontHeight - 1; int t = 1; - while(count == 0 && i - t > 0) { - count = fVisibleTextBuffer->GetString(j - firstVisible, i - t, - lastColumn, buf, attr); + while (count == 0 && i - t > 0) { + count = fVisibleTextBuffer->GetString(j - firstVisible, + i - t, lastColumn, buf, attr); t++; }