* Use the attributes from the parser instead of trying to guess blindly when inserting a tab. This avoids strange things hapenning when a tab is inserted at the start of a line.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39574 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2010-11-22 19:21:56 +00:00
parent ca598670fb
commit 384fe02234
3 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -656,21 +656,23 @@ BasicTerminalBuffer::InsertRI()
void void
BasicTerminalBuffer::InsertTab() BasicTerminalBuffer::InsertTab(uint32 attributes)
{ {
int32 x; int32 x;
fSoftWrappedCursor = false; fSoftWrappedCursor = false;
// Find the next tab stop
for (x = fCursor.x + 1; x < fWidth && !fTabStops[x]; x++) for (x = fCursor.x + 1; x < fWidth && !fTabStops[x]; x++)
; ;
// Ensure x stayx within the line bounds
x = restrict_value(x, 0, fWidth - 1); x = restrict_value(x, 0, fWidth - 1);
if (x != fCursor.x) { if (x != fCursor.x) {
TerminalLine* line = _LineAt(fCursor.y); TerminalLine* line = _LineAt(fCursor.y);
for (int32 i = fCursor.x; i <= x; i++) { for (int32 i = fCursor.x; i <= x; i++) {
line->cells[i].character = ' '; line->cells[i].character = ' ';
line->cells[i].attributes = line->cells[fCursor.x - 1].attributes; line->cells[i].attributes = attributes;
} }
fCursor.x = x; fCursor.x = x;
if (line->length < fCursor.x) if (line->length < fCursor.x)
+1 -1
View File
@@ -108,7 +108,7 @@ public:
void InsertCR(); void InsertCR();
void InsertLF(); void InsertLF();
void InsertRI(); void InsertRI();
void InsertTab(); void InsertTab(uint32 attr);
void SetInsertMode(int flag); void SetInsertMode(int flag);
void InsertSpace(int32 num); void InsertSpace(int32 num);
void InsertLines(int32 numLines); void InsertLines(int32 numLines);
+1 -1
View File
@@ -605,7 +605,7 @@ TermParse::EscParse()
break; break;
case CASE_TAB: case CASE_TAB:
fBuffer->InsertTab(); fBuffer->InsertTab(fAttr);
break; break;
case CASE_ESC: case CASE_ESC: