aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorOliver Kiehl2002-12-14 22:25:09 +0000
committerOliver Kiehl2002-12-14 22:25:09 +0000
commit02d66e1b1d7de9a0510994b93b2f83bf16d86bdb (patch)
tree8c9104ed5b2909f5db2ec5972c75dc7e52943f94 /gui
parent2f30b76ceb4859de37efad2eb9cc2413bd4cde84 (diff)
downloadscummvm-rg350-02d66e1b1d7de9a0510994b93b2f83bf16d86bdb.tar.gz
scummvm-rg350-02d66e1b1d7de9a0510994b93b2f83bf16d86bdb.tar.bz2
scummvm-rg350-02d66e1b1d7de9a0510994b93b2f83bf16d86bdb.zip
fixed ctrl-w and added ctrl-d and <delete>
svn-id: r5970
Diffstat (limited to 'gui')
-rw-r--r--gui/console.cpp24
-rw-r--r--gui/console.h1
2 files changed, 24 insertions, 1 deletions
diff --git a/gui/console.cpp b/gui/console.cpp
index 5e9316bd21..432c4db2ee 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -163,6 +163,10 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers)
scrollToCurrent();
draw(); // FIXME - not nice to redraw the full console just for one char!
break;
+ case 127:
+ killChar();
+ draw();
+ break;
/*
case 256+24: // pageup
_selectedItem -= _entriesPerPage - 1;
@@ -231,6 +235,10 @@ void ConsoleDialog::specialKeys(int keycode)
_currentPos = _promptStartPos;
draw();
break;
+ case 'd':
+ killChar();
+ draw();
+ break;
case 'e':
_currentPos = _promptEndPos;
draw();
@@ -246,6 +254,14 @@ void ConsoleDialog::specialKeys(int keycode)
}
}
+void ConsoleDialog::killChar()
+{
+ for (int i = _currentPos; i < _promptEndPos; i++)
+ _buffer[i % kBufferSize] = _buffer[(i+1) % kBufferSize];
+ _buffer[_promptEndPos % kBufferSize] = ' ';
+ _promptEndPos--;
+}
+
void ConsoleDialog::killLine()
{
for (int i = _currentPos; i < _promptEndPos; i++)
@@ -256,14 +272,20 @@ void ConsoleDialog::killLine()
void ConsoleDialog::killLastWord()
{
int pos;
+ int cnt = 0;
while (_currentPos > _promptStartPos) {
_currentPos--;
pos = getBufferPos();
if (_buffer[pos] != ' ')
- _buffer[pos] = ' ';
+ cnt++;
else
break;
}
+
+ for (int i = _currentPos; i < _promptEndPos; i++)
+ _buffer[i % kBufferSize] = _buffer[(i+cnt+1) % kBufferSize];
+ _buffer[_promptEndPos % kBufferSize] = ' ';
+ _promptEndPos--;
}
void ConsoleDialog::nextLine()
diff --git a/gui/console.h b/gui/console.h
index ad764aff5d..fd0042e9df 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -82,6 +82,7 @@ protected:
// Line editing
void specialKeys(int keycode);
+ void killChar();
void killLine();
void killLastWord();
};