mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 08:25:35 +00:00
scroll to caret if user types
svn-id: r5968
This commit is contained in:
parent
5c80aeaed6
commit
bb210766ce
@ -149,6 +149,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers)
|
|||||||
_buffer[_promptEndPos % kBufferSize] = ' ';
|
_buffer[_promptEndPos % kBufferSize] = ' ';
|
||||||
_promptEndPos--;
|
_promptEndPos--;
|
||||||
}
|
}
|
||||||
|
scrollToCurrent();
|
||||||
draw(); // FIXME - not nice to redraw the full console just for one char!
|
draw(); // FIXME - not nice to redraw the full console just for one char!
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
@ -194,6 +195,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers)
|
|||||||
_buffer[(i+1) % kBufferSize] = _buffer[i % kBufferSize];
|
_buffer[(i+1) % kBufferSize] = _buffer[i % kBufferSize];
|
||||||
_promptEndPos++;
|
_promptEndPos++;
|
||||||
putchar((char)ascii);
|
putchar((char)ascii);
|
||||||
|
scrollToCurrent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,3 +354,16 @@ void ConsoleDialog::drawCaret(bool erase)
|
|||||||
|
|
||||||
_caretVisible = !erase;
|
_caretVisible = !erase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConsoleDialog::scrollToCurrent()
|
||||||
|
{
|
||||||
|
int line = _currentPos / _lineWidth;
|
||||||
|
int displayLine = line - _scrollLine + _linesPerPage - 1;
|
||||||
|
|
||||||
|
if (displayLine < 0) {
|
||||||
|
// TODO - this should only occur for loong edit lines, though
|
||||||
|
} else if (displayLine >= _linesPerPage) {
|
||||||
|
_scrollLine = _currentPos / _lineWidth;
|
||||||
|
updateScrollBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -77,6 +77,7 @@ protected:
|
|||||||
void print(const char *str);
|
void print(const char *str);
|
||||||
void nextLine();
|
void nextLine();
|
||||||
void updateScrollBar();
|
void updateScrollBar();
|
||||||
|
void scrollToCurrent();
|
||||||
inline int getBufferPos() const { return _currentPos % kBufferSize; }
|
inline int getBufferPos() const { return _currentPos % kBufferSize; }
|
||||||
|
|
||||||
// Line editing
|
// Line editing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user