[Lldb-commits] [PATCH] D108414: [LLDB][GUI] Handle extra navigation keys in forms

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 23 22:43:14 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG292f013395f2: [LLDB][GUI] Handle extra navigation keys in forms (authored by OmarEmaraDev, committed by clayborg).

Changed prior to commit:
  https://reviews.llvm.org/D108414?vs=367629&id=368277#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108414/new/

https://reviews.llvm.org/D108414

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp


Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===================================================================
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -2801,6 +2801,8 @@
     }
   }
 
+  // Always return eKeyHandled to absorb all events since forms are always
+  // added as pop-ups that should take full control until canceled or submitted.
   HandleCharResult WindowDelegateHandleChar(Window &window, int key) override {
     switch (key) {
     case '\r':
@@ -2815,9 +2817,11 @@
       ExecuteAction(window, 0);
       return eKeyHandled;
     case '\t':
-      return SelectNext(key);
+      SelectNext(key);
+      return eKeyHandled;
     case KEY_SHIFT_TAB:
-      return SelectPrevious(key);
+      SelectPrevious(key);
+      return eKeyHandled;
     case KEY_ESCAPE:
       window.GetParent()->RemoveSubWindow(&window);
       return eKeyHandled;
@@ -2829,10 +2833,24 @@
     // to that field.
     if (m_selection_type == SelectionType::Field) {
       FieldDelegate *field = m_delegate_sp->GetField(m_selection_index);
-      return field->FieldDelegateHandleChar(key);
+      if (field->FieldDelegateHandleChar(key) == eKeyHandled)
+        return eKeyHandled;
     }
 
-    return eKeyNotHandled;
+    // If the key wasn't handled by the possibly selected field, handle some
+    // extra keys for navigation.
+    switch (key) {
+    case KEY_DOWN:
+      SelectNext(key);
+      return eKeyHandled;
+    case KEY_UP:
+      SelectPrevious(key);
+      return eKeyHandled;
+    default:
+      break;
+    }
+
+    return eKeyHandled;
   }
 
 protected:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108414.368277.patch
Type: text/x-patch
Size: 1624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210824/9a340fc0/attachment.bin>


More information about the lldb-commits mailing list