aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/console.cpp17
-rw-r--r--gui/console.h2
2 files changed, 6 insertions, 13 deletions
diff --git a/gui/console.cpp b/gui/console.cpp
index 078661930b..360aaaf6a4 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -136,11 +136,7 @@ void ConsoleDialog::handleTickle() {
uint32 time = g_system->get_msecs();
if (_caretTime < time) {
_caretTime = time + kCaretBlinkTime;
- if (_caretVisible) {
- drawCaret(true);
- } else {
- drawCaret(false);
- }
+ drawCaret(_caretVisible);
}
}
@@ -159,12 +155,10 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
nextLine();
+ assert(_promptEndPos >= _promptStartPos);
int len = _promptEndPos - _promptStartPos;
bool keepRunning = true;
- // FIXME - len should NEVER be negative. If anything makes it negative,
- // then the code doing that is buggy and needs to be fixed.
- assert(len >= 0);
if (len > 0) {
@@ -530,12 +524,11 @@ void ConsoleDialog::drawCaret(bool erase) {
void ConsoleDialog::scrollToCurrent() {
int line = _currentPos / _lineWidth;
- int displayLine = line - _scrollLine + _linesPerPage - 1;
- if (displayLine < 0) {
+ if (line + _linesPerPage <= _scrollLine) {
// TODO - this should only occur for loong edit lines, though
- } else if (displayLine >= _linesPerPage) {
- _scrollLine = _currentPos / _lineWidth;
+ } else if (line > _scrollLine) {
+ _scrollLine = line;
updateScrollBar();
}
}
diff --git a/gui/console.h b/gui/console.h
index caf1a2d7ae..019078fb1b 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -108,13 +108,13 @@ protected:
void putcharIntern(int c);
void insertIntoPrompt(const char *str);
void print(const char *str);
- void nextLine();
void updateScrollBar();
void scrollToCurrent();
inline int getBufferPos() const { return _currentPos % kBufferSize; }
// Line editing
void specialKeys(int keycode);
+ void nextLine();
void killChar();
void killLine();
void killLastWord();