[Lldb-commits] [PATCH] D108410: [LLDB][GUI] Add submit form key combination
Greg Clayton via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 23 22:07:42 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG945cde8b6a45: [LLDB][GUI] Add submit form key combination (authored by OmarEmaraDev, committed by clayborg).
Changed prior to commit:
https://reviews.llvm.org/D108410?vs=367612&id=368273#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108410/new/
https://reviews.llvm.org/D108410
Files:
lldb/source/Core/IOHandlerCursesGUI.cpp
Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===================================================================
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -93,6 +93,7 @@
#define KEY_DELETE 127
#define KEY_SHIFT_TAB (KEY_MAX + 1)
+#define KEY_ALT_ENTER (KEY_MAX + 2)
namespace curses {
class Menu;
@@ -2315,6 +2316,7 @@
// action that requires valid fields.
bool CheckFieldsValidity() {
for (int i = 0; i < GetNumberOfFields(); i++) {
+ GetField(i)->FieldDelegateExitCallback();
if (GetField(i)->FieldDelegateHasError()) {
SetError("Some fields are invalid!");
return false;
@@ -2649,13 +2651,24 @@
Size(width, copy_height));
}
+ void DrawSubmitHint(Surface &surface, bool is_active) {
+ surface.MoveCursor(2, surface.GetHeight() - 1);
+ if (is_active)
+ surface.AttributeOn(A_BOLD | COLOR_PAIR(BlackOnWhite));
+ surface.Printf("[Press Alt+Enter to %s]",
+ m_delegate_sp->GetAction(0).GetLabel().c_str());
+ if (is_active)
+ surface.AttributeOff(A_BOLD | COLOR_PAIR(BlackOnWhite));
+ }
+
bool WindowDelegateDraw(Window &window, bool force) override {
m_delegate_sp->UpdateFieldsVisibility();
window.Erase();
window.DrawTitleBox(m_delegate_sp->GetName().c_str(),
- "Press Esc to cancel");
+ "Press Esc to Cancel");
+ DrawSubmitHint(window, window.IsActive());
Rect content_bounds = window.GetFrame();
content_bounds.Inset(2, 2);
@@ -2778,8 +2791,8 @@
return eKeyHandled;
}
- void ExecuteAction(Window &window) {
- FormAction &action = m_delegate_sp->GetAction(m_selection_index);
+ void ExecuteAction(Window &window, int index) {
+ FormAction &action = m_delegate_sp->GetAction(index);
action.Execute(window);
if (m_delegate_sp->HasError()) {
m_first_visible_line = 0;
@@ -2794,10 +2807,13 @@
case '\n':
case KEY_ENTER:
if (m_selection_type == SelectionType::Action) {
- ExecuteAction(window);
+ ExecuteAction(window, m_selection_index);
return eKeyHandled;
}
break;
+ case KEY_ALT_ENTER:
+ ExecuteAction(window, 0);
+ return eKeyHandled;
case '\t':
return SelectNext(key);
case KEY_SHIFT_TAB:
@@ -7458,6 +7474,7 @@
static_assert(LastColorPairIndex == 18, "Color indexes do not match.");
define_key("\033[Z", KEY_SHIFT_TAB);
+ define_key("\033\015", KEY_ALT_ENTER);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108410.368273.patch
Type: text/x-patch
Size: 2561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210824/a8c29636/attachment.bin>
More information about the lldb-commits
mailing list