Skip to content
Snippets Groups Projects
Commit 5e19c67a authored by Axel Naumann's avatar Axel Naumann
Browse files

Implement M-Backspace (CutPrevWord)

git-svn-id: http://root.cern.ch/svn/root/trunk@40692 27541ba8-7e3a-0410-8455-c3a389f83636
parent 0341d278
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@ namespace textinput {
fEscPending = false;
if (In.IsRaw()) {
if (In.GetModifier() & InputData::kModCtrl) {
return ToCommandCtrl(In.GetRaw());
return ToCommandCtrl(In.GetRaw(), HadEscPending);
}
if (HadEscPending) {
......@@ -39,7 +39,8 @@ namespace textinput {
}
Editor::Command
KeyBinding::ToCommandCtrl(char In) {
KeyBinding::ToCommandCtrl(char In,
bool HadEscPending) {
// Control was pressed and In was hit. Convert to command.
typedef Editor::Command C;
switch (In) {
......@@ -51,7 +52,12 @@ namespace textinput {
case 'e' - 0x60: return C(Editor::kMoveEnd);
case 'f' - 0x60: return C(Editor::kMoveRight);
case 'g' - 0x60: return C(Editor::kMoveRight);
case 'h' - 0x60: return C(Editor::kCmdDelLeft);
case 'h' - 0x60:
if (HadEscPending) {
return C(Editor::kCmdCutPrevWord);
} else {
return C(Editor::kCmdDelLeft);
}
case 'i' - 0x60: return C(Editor::kCmdComplete);
case 'j' - 0x60: return C(Editor::kCmdEnter);
case 'k' - 0x60: return C(Editor::kCmdCutToEnd);
......@@ -74,7 +80,12 @@ namespace textinput {
case 'z' - 0x60:
return C(In, Editor::kCKControl);
case 0x1f: return C(Editor::kCmdUndo);
case 0x7f: return C(Editor::kCmdDelLeft); // MacOS
case 0x7f: // MacOS
if (HadEscPending) {
return C(Editor::kCmdCutPrevWord);
} else {
return C(Editor::kCmdDelLeft);
}
default: return C(In, Editor::kCKError);
}
// Cannot reach:
......@@ -114,7 +125,12 @@ namespace textinput {
case InputData::kEIRight: return C(Editor::kMoveRight);
case InputData::kEIPgUp: return C(Editor::kCmdIgnore);
case InputData::kEIPgDown: return C(Editor::kCmdIgnore);
case InputData::kEIBackSpace: return C(Editor::kCmdDelLeft);
case InputData::kEIBackSpace:
if (HadEscPending) {
return C(Editor::kCmdCutPrevWord);
} else {
return C(Editor::kCmdDelLeft);
}
case InputData::kEIDel:
if (HadEscPending) {
return C(Editor::kCmdCutPrevWord);
......
......@@ -34,7 +34,7 @@ namespace textinput {
bool IsEscPending() const { return fEscPending; }
private:
Editor::Command ToCommandCtrl(char In);
Editor::Command ToCommandCtrl(char In, bool HadEscPending);
Editor::Command ToCommandEsc(char In);
Editor::Command ToCommandExtended(InputData::EExtendedInput EI,
bool HadEscPending);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment