diff options
author | Johannes Schickel | 2010-02-01 18:18:20 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-02-01 18:18:20 +0000 |
commit | 17f198369d76dd86e502f3095deec142a3252dba (patch) | |
tree | 68be5e8ff331b31974fb6441aca993bd5601cde8 /gui/console.cpp | |
parent | 56782692808300096d5da98a6c52b45817525577 (diff) | |
download | scummvm-rg350-17f198369d76dd86e502f3095deec142a3252dba.tar.gz scummvm-rg350-17f198369d76dd86e502f3095deec142a3252dba.tar.bz2 scummvm-rg350-17f198369d76dd86e502f3095deec142a3252dba.zip |
Fix assert after ^W and Delete key events in the debugger, when there's nothing on the line.
svn-id: r47801
Diffstat (limited to 'gui/console.cpp')
-rw-r--r-- | gui/console.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gui/console.cpp b/gui/console.cpp index 9ac9cf09e1..ad3f30ac1b 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -468,8 +468,10 @@ void ConsoleDialog::specialKeys(int keycode) { void ConsoleDialog::killChar() { for (int i = _currentPos; i < _promptEndPos; i++) buffer(i) = buffer(i + 1); - buffer(_promptEndPos) = ' '; - _promptEndPos--; + if (_promptEndPos > _promptStartPos) { + buffer(_promptEndPos) = ' '; + _promptEndPos--; + } } void ConsoleDialog::killLine() { @@ -493,8 +495,10 @@ void ConsoleDialog::killLastWord() { for (int i = _currentPos; i < _promptEndPos; i++) buffer(i) = buffer(i + cnt); - buffer(_promptEndPos) = ' '; - _promptEndPos -= cnt; + if (_promptEndPos > _promptStartPos) { + buffer(_promptEndPos) = ' '; + _promptEndPos -= cnt; + } } void ConsoleDialog::addToHistory(const char *str) { |