When inserting tabs or other whitespace, propagate the attributes of the previous characters.

This allows mc to render properly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38318 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-08-23 13:31:39 +00:00
parent a84802e488
commit 9ad52ae4cc
2 changed files with 14 additions and 11 deletions

View File

@ -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);

View File

@ -1112,11 +1112,7 @@ 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];
// Selection check.
@ -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++;
}