aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-11-28 22:08:52 +0000
committerMax Horn2003-11-28 22:08:52 +0000
commit3944eb4494b59749e88e449c8856521b2a4a3672 (patch)
treeb40bb05c653a2f464017a91f8df8faecb2b95e7c
parent54aa33310d1dbd9f04e2ede970d8e17200798000 (diff)
downloadscummvm-rg350-3944eb4494b59749e88e449c8856521b2a4a3672.tar.gz
scummvm-rg350-3944eb4494b59749e88e449c8856521b2a4a3672.tar.bz2
scummvm-rg350-3944eb4494b59749e88e449c8856521b2a4a3672.zip
cleanup
svn-id: r11416
-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();