Rename Key::Erase to Key::Delete and add 'del' keyname

Fixes #145
Fixes #146
This commit is contained in:
Maxime Coste 2014-05-25 17:41:28 +01:00
parent fe70add4b7
commit 811f1c2d76
4 changed files with 5 additions and 4 deletions

View File

@ -138,7 +138,7 @@ public:
--m_cursor_pos; --m_cursor_pos;
} }
} }
else if (key == Key::Erase) else if (key == Key::Delete)
{ {
if (m_cursor_pos != m_line.char_length()) if (m_cursor_pos != m_line.char_length())
m_line = m_line.substr(0, m_cursor_pos) m_line = m_line.substr(0, m_cursor_pos)
@ -675,7 +675,7 @@ public:
buffer.erase(utf8::previous(pos), pos); buffer.erase(utf8::previous(pos), pos);
} }
} }
else if (key == Key::Erase) else if (key == Key::Delete)
{ {
for (auto& sel : context().selections()) for (auto& sel : context().selections())
{ {

View File

@ -34,6 +34,7 @@ static const KeyAndName keynamemap[] = {
{ "home", Key::Home }, { "home", Key::Home },
{ "end", Key::End }, { "end", Key::End },
{ "backtab", Key::BackTab }, { "backtab", Key::BackTab },
{ "del", Key::Delete },
}; };
KeyList parse_keys(StringView str) KeyList parse_keys(StringView str)

View File

@ -22,7 +22,7 @@ struct Key
{ {
// use UTF-16 surrogate pairs range // use UTF-16 surrogate pairs range
Backspace = 0xD800, Backspace = 0xD800,
Erase, Delete,
Escape, Escape,
Up, Up,
Down, Down,

View File

@ -359,7 +359,7 @@ Key NCursesUI::get_key()
else switch (c) else switch (c)
{ {
case KEY_BACKSPACE: case 127: return Key::Backspace; case KEY_BACKSPACE: case 127: return Key::Backspace;
case KEY_DC: return Key::Erase; case KEY_DC: return Key::Delete;
case KEY_UP: return Key::Up; case KEY_UP: return Key::Up;
case KEY_DOWN: return Key::Down; case KEY_DOWN: return Key::Down;
case KEY_LEFT: return Key::Left; case KEY_LEFT: return Key::Left;