Make ctrl-c terminate the current input line and start an empty line, instead of the previous content.
rdar://problem/11412821 llvm-svn: 156510
This commit is contained in:
parent
a21bd407e5
commit
fd02a89960
|
@ -1081,6 +1081,8 @@ Driver::EditLineInputReaderCallback
|
||||||
if (driver->m_io_channel_ap.get() != NULL)
|
if (driver->m_io_channel_ap.get() != NULL)
|
||||||
{
|
{
|
||||||
driver->m_io_channel_ap->OutWrite ("^C\n", 3, NO_ASYNC);
|
driver->m_io_channel_ap->OutWrite ("^C\n", 3, NO_ASYNC);
|
||||||
|
// I wish I could erase the entire input line, but there's no public API for that.
|
||||||
|
driver->m_io_channel_ap->EraseCharsBeforeCursor();
|
||||||
driver->m_io_channel_ap->RefreshPrompt();
|
driver->m_io_channel_ap->RefreshPrompt();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -50,6 +50,13 @@ IOChannel::GetPrompt ()
|
||||||
return pos->second.c_str();
|
return pos->second.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
IOChannel::EraseCharsBeforeCursor ()
|
||||||
|
{
|
||||||
|
const LineInfo *line_info = el_line(m_edit_line);
|
||||||
|
el_deletestr(m_edit_line, line_info->cursor - line_info->buffer);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char
|
unsigned char
|
||||||
IOChannel::ElCompletionFn (EditLine *e, int ch)
|
IOChannel::ElCompletionFn (EditLine *e, int ch)
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,6 +96,9 @@ public:
|
||||||
const char *
|
const char *
|
||||||
GetPrompt ();
|
GetPrompt ();
|
||||||
|
|
||||||
|
void
|
||||||
|
EraseCharsBeforeCursor ();
|
||||||
|
|
||||||
static unsigned char
|
static unsigned char
|
||||||
ElCompletionFn (EditLine *e, int ch);
|
ElCompletionFn (EditLine *e, int ch);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue