|
|
|
@ -648,15 +648,27 @@ namespace DFHack
|
|
|
|
|
prompt_refresh();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 21: // Ctrl+u, delete the whole line.
|
|
|
|
|
raw_buffer.clear();
|
|
|
|
|
case 21: // Ctrl+u, delete from current to beginning of line.
|
|
|
|
|
if (raw_cursor > 0)
|
|
|
|
|
yank_buffer = raw_buffer.substr(0, raw_cursor);
|
|
|
|
|
raw_buffer.erase(0, raw_cursor);
|
|
|
|
|
raw_cursor = 0;
|
|
|
|
|
prompt_refresh();
|
|
|
|
|
break;
|
|
|
|
|
case 11: // Ctrl+k, delete from current to end of line.
|
|
|
|
|
if (raw_cursor < raw_buffer.size())
|
|
|
|
|
yank_buffer = raw_buffer.substr(raw_cursor, raw_buffer.size() - raw_cursor);
|
|
|
|
|
raw_buffer.erase(raw_cursor);
|
|
|
|
|
prompt_refresh();
|
|
|
|
|
break;
|
|
|
|
|
case 25: // Ctrl+y, paste last text deleted with Ctrl+u/k
|
|
|
|
|
if (yank_buffer.size())
|
|
|
|
|
{
|
|
|
|
|
raw_buffer.insert(raw_cursor, yank_buffer);
|
|
|
|
|
raw_cursor += yank_buffer.size();
|
|
|
|
|
prompt_refresh();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 1: // Ctrl+a, go to the start of the line
|
|
|
|
|
raw_cursor = 0;
|
|
|
|
|
prompt_refresh();
|
|
|
|
@ -686,6 +698,7 @@ namespace DFHack
|
|
|
|
|
bool in_batch;
|
|
|
|
|
std::string prompt; // current prompt string
|
|
|
|
|
std::string raw_buffer; // current raw mode buffer
|
|
|
|
|
std::string yank_buffer; // last text deleted with Ctrl-K/Ctrl-U
|
|
|
|
|
int raw_cursor; // cursor position in the buffer
|
|
|
|
|
// thread exit mechanism
|
|
|
|
|
int exit_pipe[2];
|
|
|
|
|