[Lldb-commits] [PATCH] D85089: Implement shift+tab for going back in lldb gui views
Luboš Luňák via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 5 00:51:55 PDT 2020
This revision was automatically updated to reflect the committed changes.
llunak marked 2 inline comments as done.
Closed by commit rG7a63dc534eb8: [lldb][gui] implement shift+tab for going back in views (authored by llunak).
Herald added a subscriber: lldb-commits.
Changed prior to commit:
https://reviews.llvm.org/D85089?vs=282441&id=283149#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85089/new/
https://reviews.llvm.org/D85089
Files:
lldb/source/Core/IOHandlerCursesGUI.cpp
Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===================================================================
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -692,42 +692,44 @@
void SelectNextWindowAsActive() {
// Move active focus to next window
- const size_t num_subwindows = m_subwindows.size();
- if (m_curr_active_window_idx == UINT32_MAX) {
- uint32_t idx = 0;
- for (auto subwindow_sp : m_subwindows) {
- if (subwindow_sp->GetCanBeActive()) {
- m_curr_active_window_idx = idx;
- break;
- }
- ++idx;
- }
- } else if (m_curr_active_window_idx + 1 < num_subwindows) {
- bool handled = false;
+ const int num_subwindows = m_subwindows.size();
+ int start_idx = 0;
+ if (m_curr_active_window_idx != UINT32_MAX) {
m_prev_active_window_idx = m_curr_active_window_idx;
- for (size_t idx = m_curr_active_window_idx + 1; idx < num_subwindows;
- ++idx) {
- if (m_subwindows[idx]->GetCanBeActive()) {
- m_curr_active_window_idx = idx;
- handled = true;
- break;
- }
+ start_idx = m_curr_active_window_idx + 1;
+ }
+ for (int idx = start_idx; idx < num_subwindows; ++idx) {
+ if (m_subwindows[idx]->GetCanBeActive()) {
+ m_curr_active_window_idx = idx;
+ return;
}
- if (!handled) {
- for (size_t idx = 0; idx <= m_prev_active_window_idx; ++idx) {
- if (m_subwindows[idx]->GetCanBeActive()) {
- m_curr_active_window_idx = idx;
- break;
- }
- }
+ }
+ for (int idx = 0; idx < start_idx; ++idx) {
+ if (m_subwindows[idx]->GetCanBeActive()) {
+ m_curr_active_window_idx = idx;
+ break;
}
- } else {
+ }
+ }
+
+ void SelectPreviousWindowAsActive() {
+ // Move active focus to previous window
+ const int num_subwindows = m_subwindows.size();
+ int start_idx = num_subwindows - 1;
+ if (m_curr_active_window_idx != UINT32_MAX) {
m_prev_active_window_idx = m_curr_active_window_idx;
- for (size_t idx = 0; idx < num_subwindows; ++idx) {
- if (m_subwindows[idx]->GetCanBeActive()) {
- m_curr_active_window_idx = idx;
- break;
- }
+ start_idx = m_curr_active_window_idx - 1;
+ }
+ for (int idx = start_idx; idx >= 0; --idx) {
+ if (m_subwindows[idx]->GetCanBeActive()) {
+ m_curr_active_window_idx = idx;
+ return;
+ }
+ }
+ for (int idx = num_subwindows - 1; idx > start_idx; --idx) {
+ if (m_subwindows[idx]->GetCanBeActive()) {
+ m_curr_active_window_idx = idx;
+ break;
}
}
}
@@ -2928,6 +2930,10 @@
window.SelectNextWindowAsActive();
return eKeyHandled;
+ case KEY_BTAB:
+ window.SelectPreviousWindowAsActive();
+ return eKeyHandled;
+
case 'h':
window.CreateHelpSubwindow();
return eKeyHandled;
@@ -2952,6 +2958,7 @@
KeyHelp *WindowDelegateGetKeyHelp() override {
static curses::KeyHelp g_source_view_key_help[] = {
{'\t', "Select next view"},
+ {KEY_BTAB, "Select previous view"},
{'h', "Show help dialog with view specific key bindings"},
{',', "Page up"},
{'.', "Page down"},
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85089.283149.patch
Type: text/x-patch
Size: 3334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200805/7824a1d7/attachment.bin>
More information about the lldb-commits
mailing list