Made the paging mechanism a bit more useful for commands: it will now wait when

the command would overwrite its own output, not always on the bottom of the
screen.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23699 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-01-22 08:24:35 +00:00
parent 6eabbacd70
commit a39bfc19fd
1 changed files with 37 additions and 31 deletions

View File

@ -103,46 +103,52 @@ scroll_up(void)
static void static void
next_line(void) next_line(void)
{ {
#if USE_SCROLLING
// TODO: scrolling is usually too slow; we could probably just remove it
if (sScreen.y == sScreen.rows - 1)
scroll_up();
else
sScreen.y++;
#else
if (in_command_invocation()) if (in_command_invocation())
sScreen.in_command_rows++; sScreen.in_command_rows++;
else else
sScreen.in_command_rows = 0; sScreen.in_command_rows = 0;
if (sScreen.y == sScreen.rows - 1) { if (sScreen.paging && ((sScreen.in_command_rows > 0
#if USE_SCROLLING && ((sScreen.in_command_rows + 3) % sScreen.rows) == 0)
scroll_up(); || (sScreen.boot_debug_output && sScreen.y == sScreen.rows - 1))) {
#else // Use the paging mechanism: either, we're in the debugger, and a
// command is being executed, or we're currently showing boot debug
if (sScreen.paging // output
&& (sScreen.in_command_rows > 1 || sScreen.boot_debug_output)) { const char *text = "Press key to continue, Q to quit";
// We're in the debugger, and a command is being executed int32 length = strlen(text);
const char *text = "Press key to continue, Q to quit"; if (sScreen.x + length > sScreen.columns) {
int32 length = strlen(text); // make sure we don't overwrite too much
if (sScreen.x + length > sScreen.columns) { text = "P";
// make sure we don't overwrite too much length = 1;
text = "P";
length = 1;
}
for (int32 i = 0; i < length; i++) {
sModule->put_glyph(sScreen.columns - length + i, sScreen.y,
text[i], sScreen.boot_debug_output ? 0x6f : 0xf0);
}
char c = blue_screen_getchar();
if (c == 'q')
sScreen.ignore_output = true;
// remove on screen text again
sModule->fill_glyph(sScreen.columns - length, sScreen.y, length,
1, ' ', sScreen.attr);
} }
for (int32 i = 0; i < length; i++) {
// yellow on black (or reverse, during boot)
sModule->put_glyph(sScreen.columns - length + i, sScreen.y,
text[i], sScreen.boot_debug_output ? 0x6f : 0xf6);
}
char c = blue_screen_getchar();
if (c == 'q')
sScreen.ignore_output = true;
// remove on screen text again
sModule->fill_glyph(sScreen.columns - length, sScreen.y, length,
1, ' ', sScreen.attr);
}
if (sScreen.y == sScreen.rows - 1) {
sScreen.y = 0; sScreen.y = 0;
sModule->fill_glyph(0, 0, sScreen.columns, 2, ' ', sScreen.attr); sModule->fill_glyph(0, 0, sScreen.columns, 2, ' ', sScreen.attr);
#endif } else
} else if (sScreen.y < sScreen.rows - 1) {
sScreen.y++; sScreen.y++;
} #endif
#if NO_CLEAR #if NO_CLEAR
if (sScreen.y + 2 < sScreen.rows) { if (sScreen.y + 2 < sScreen.rows) {