summaryrefslogtreecommitdiffstats
path: root/Source/CursesDialog/cmCursesStringWidget.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CursesDialog/cmCursesStringWidget.cxx')
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index 6eb5310..46b8b86 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -67,8 +67,10 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
int x, y;
FORM* form = fm->GetForm();
+ // when not in edit mode, edit mode is entered by pressing enter or i (vim
+ // binding)
// 10 == enter
- if (!this->InEdit && (key != 10 && key != KEY_ENTER)) {
+ if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) {
return false;
}
@@ -97,11 +99,15 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
}
// If resize occurred during edit, move out of edit mode
- if (!this->InEdit && (key != 10 && key != KEY_ENTER)) {
+ if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) {
return false;
}
- // 10 == enter
- if (key == 10 || key == KEY_ENTER) {
+ // enter edit with return and i (vim binding)
+ if (!this->InEdit && (key == 10 || key == KEY_ENTER || key == 'i')) {
+ this->OnReturn(fm, w);
+ }
+ // leave edit with return (but not i -- not a toggle)
+ else if (this->InEdit && (key == 10 || key == KEY_ENTER)) {
this->OnReturn(fm, w);
} else if (key == KEY_DOWN || key == ctrl('n') || key == KEY_UP ||
key == ctrl('p') || key == KEY_NPAGE || key == ctrl('d') ||