[Lldb-commits] [PATCH] D108545: [LLDB][GUI] Add initial searcher support

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 23 23:17:02 PDT 2021


clayborg added a comment.

I like the look of this. It seems we would want this kind of auto complete in many fields that we already have, like the file or directory dialogs to start with.

My main question is do we need a full window for this, or can be paint a window that is just the search results? My thinking is that the right arrow key could be used to auto complete a text field if we are at the end of the input. If we have a file dialog and you type "~/" and then RIGHT arrow, it would be great if this window could appear right at the correct location and not look like a complete new window, but just a popup window that augments an existing Field (not necessarily a text field!) right below with minimal bordering so that it blends into the current form. You can select things using the up and down arrows, press enter to update the text, or keep typing to filter more.

Maybe we can:

- Maybe we add a "SearcherWindowDelegate *m_search_window;" member to FormDelegate so that this helper UI can appear when needed for any FieldDelegate that requests/needs it
  - "m_search_window" can be set to a non NULL value when one of the FieldDelegates in the FormDelegate asks for auto completion and provides a SearcherDelegate to use and a pointer to the FieldDelegate itself so that the SearcherWindowDelegate can be positioned correctly
  - If "m_search_window" is NULL, then never show this UI
  - If "m_search_window" is not NULL, then some keys get sent to the searcher delegate before or after the field gets them so it can do the choices UI
    - if the user hits ENTER, then the Field is asked to update its value via some API in FieldDelegate, and the GUI for the matches disappears and m_search_window is freed and set to NULL again

We should hook up at least one of the FieldDelegate objects so that it uses this functionality so we can play with it in this patch to make sure it works.

Let me know if you had other plans for this window and how it would be used.



================
Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:3592
+        m_selected_match(0), m_first_visible_match(0) {
+    ;
+  }
----------------
Should we be doing just like any other dialog that we have created and be constructing these items on the fly?

```
m_text_field = AddTextField("Search", "", true);
```
It seems the matches could use a modified ChoicesField for the matches? Are you currently drawing the choices (matches) manually?


================
Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:3635
+
+  void DrawMatches(Surface &surface) {
+    if (m_delegate_sp->GetNumberOfMatches() == 0)
----------------
Seems like this could be done using a ChoicesField no instead of drawing manually?


================
Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:3731
+  SearcherDelegateSP m_delegate_sp;
+  TextFieldDelegate m_text_field;
+  // The index of the currently selected match.
----------------
Is this a new text field itself, or designed to be a reference to an existing text field? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108545



More information about the lldb-commits mailing list