Browse Source

ccmake: Avoid using non-portable 'curcol' field (#15739)

'curcol' is an implementation detail of ncurses so other implementations
of 'form' may not have it.  The switch-to-previous-field logic only
exists for overloaded requests of REQ_DEL_PREV, so no need to check for
REQ_DEL_CHAR.  For REQ_DEL_PREV, check if the field changed and if it
did, change it back.
Joerg Sonnenberger 10 years ago
parent
commit
da1a02f77f
1 changed files with 6 additions and 7 deletions
  1. 6 7
      Source/CursesDialog/cmCursesStringWidget.cxx

+ 6 - 7
Source/CursesDialog/cmCursesStringWidget.cxx

@@ -168,17 +168,16 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
     else if ( key == 127 ||
               key == KEY_BACKSPACE )
       {
-      if ( form->curcol > 0 )
-        {
+        FIELD *cur = current_field(form);
         form_driver(form, REQ_DEL_PREV);
-        }
+        if (current_field(form) != cur)
+          {
+          set_current_field(form, cur);
+          }
       }
     else if ( key == ctrl('d') ||key == KEY_DC )
       {
-      if ( form->curcol >= 0 )
-        {
-        form_driver(form, REQ_DEL_CHAR);
-        }
+      form_driver(form, REQ_DEL_CHAR);
       }
     else
       {