From 659e004de07403682f2f56c8d5a72138cdc0dec4 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sat, 17 Jan 2026 02:26:07 +0100 Subject: Implement UI resizing with Ctrl+Arrows --- tdbg.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tdbg.cpp b/tdbg.cpp index f66f35a..1ac21f7 100644 --- a/tdbg.cpp +++ b/tdbg.cpp @@ -18,10 +18,10 @@ using namespace lldb; struct LayoutConfig { - int log_height = 10; int status_height = 1; int watch_height = 15; int sidebar_width = 50; + int log_height = 5; } layout_config; // https://unicodeplus.com @@ -660,7 +660,7 @@ void draw_status_bar(SBProcess &process, InputMode mode, int width, int height) } state_str += (mode == INPUT_MODE_NORMAL) - ? " | r=Run, b=Add breakpoint, p=Print, w=Watch, n=Step Over, s=Step Into, o=Step Out, c=Continue, q=Quit" + ? " | r=Run, b=Add breakpoint, p=Print, w=Watch, n=Step Over, s=Step Into, o=Step Out, c=Continue, Ctrl+Arrows=Resize, q=Quit" : " | Enter=Confirm, Esc=Cancel"; for (int x = 0; x < width; ++x) { @@ -866,15 +866,18 @@ int main(int argc, char** argv) { case 's': if (thread.IsValid()) thread.StepInto(); break; case 'o': if (thread.IsValid()) thread.StepOut(); break; case 'c': process.Continue(); break; - case '<': layout_config.sidebar_width = std::min(width - 20, layout_config.sidebar_width + 2); break; - case '>': layout_config.sidebar_width = std::max(20, layout_config.sidebar_width - 2); break; - } - } else { - switch (ev.ch) { - case '<': layout_config.sidebar_width = std::min(width - 20, layout_config.sidebar_width + 2); break; - case '>': layout_config.sidebar_width = std::max(20, layout_config.sidebar_width - 2); break; } } + + if (ev.key == TB_KEY_ARROW_LEFT && (ev.mod & TB_MOD_CTRL)) { + layout_config.sidebar_width = std::min(width - 20, layout_config.sidebar_width + 2); + } else if (ev.key == TB_KEY_ARROW_RIGHT && (ev.mod & TB_MOD_CTRL)) { + layout_config.sidebar_width = std::max(20, layout_config.sidebar_width - 2); + } else if (ev.key == TB_KEY_ARROW_UP && (ev.mod & TB_MOD_CTRL)) { + layout_config.log_height = std::min(height - 10, layout_config.log_height + 1); + } else if (ev.key == TB_KEY_ARROW_DOWN && (ev.mod & TB_MOD_CTRL)) { + layout_config.log_height = std::max(5, layout_config.log_height - 1); + } } } else if (mode == INPUT_MODE_BREAKPOINT || mode == INPUT_MODE_VARIABLE || mode == INPUT_MODE_WATCH) { if (ev.key == TB_KEY_ESC) { -- cgit v1.2.3