Implement UI resizing with Ctrl+Arrows

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2026-01-17 02:26:07 +0100
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2026-01-17 02:26:07 +0100
Commit 659e004de07403682f2f56c8d5a72138cdc0dec4 (patch)
-rw-r--r-- tdbg.cpp 21
1 files changed, 12 insertions, 9 deletions
diff --git a/tdbg.cpp b/tdbg.cpp
...
18
using namespace lldb;
18
using namespace lldb;
19
  
19
  
20
struct LayoutConfig {
20
struct LayoutConfig {
21
	int log_height = 10;
  
22
	int status_height = 1;
21
	int status_height = 1;
23
	int watch_height = 15;
22
	int watch_height = 15;
24
	int sidebar_width = 50;
23
	int sidebar_width = 50;
  
24
	int log_height = 5;
25
} layout_config;
25
} layout_config;
26
  
26
  
27
// https://unicodeplus.com
27
// https://unicodeplus.com
...
660
	}
660
	}
661
  
661
  
662
	state_str += (mode == INPUT_MODE_NORMAL)
662
	state_str += (mode == INPUT_MODE_NORMAL)
663
		? " | r=Run, b=Add breakpoint, p=Print, w=Watch, n=Step Over, s=Step Into, o=Step Out, c=Continue, q=Quit"
663
		? " | 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"
664
		: " | Enter=Confirm, Esc=Cancel";
664
		: " | Enter=Confirm, Esc=Cancel";
665
  
665
  
666
	for (int x = 0; x < width; ++x) {
666
	for (int x = 0; x < width; ++x) {
...
866
								case 's': if (thread.IsValid()) thread.StepInto(); break;
866
								case 's': if (thread.IsValid()) thread.StepInto(); break;
867
								case 'o': if (thread.IsValid()) thread.StepOut(); break;
867
								case 'o': if (thread.IsValid()) thread.StepOut(); break;
868
								case 'c': process.Continue(); break;
868
								case 'c': process.Continue(); break;
869
								case '<': layout_config.sidebar_width = std::min(width - 20, layout_config.sidebar_width + 2); break;
  
870
								case '>': layout_config.sidebar_width = std::max(20, layout_config.sidebar_width - 2); break;
  
871
							}
869
							}
872
						} else {
870
						}
873
							switch (ev.ch) {
871
						
874
								case '<': layout_config.sidebar_width = std::min(width - 20, layout_config.sidebar_width + 2); break;
872
						if (ev.key == TB_KEY_ARROW_LEFT && (ev.mod & TB_MOD_CTRL)) {
875
								case '>': layout_config.sidebar_width = std::max(20, layout_config.sidebar_width - 2); break;
873
							layout_config.sidebar_width = std::min(width - 20, layout_config.sidebar_width + 2);
876
							}
874
						} else if (ev.key == TB_KEY_ARROW_RIGHT && (ev.mod & TB_MOD_CTRL)) {
  
875
							layout_config.sidebar_width = std::max(20, layout_config.sidebar_width - 2);
  
876
						} else if (ev.key == TB_KEY_ARROW_UP && (ev.mod & TB_MOD_CTRL)) {
  
877
							layout_config.log_height = std::min(height - 10, layout_config.log_height + 1);
  
878
						} else if (ev.key == TB_KEY_ARROW_DOWN && (ev.mod & TB_MOD_CTRL)) {
  
879
							layout_config.log_height = std::max(5, layout_config.log_height - 1);
877
						}
880
						}
878
					}
881
					}
879
				} else if (mode == INPUT_MODE_BREAKPOINT || mode == INPUT_MODE_VARIABLE || mode == INPUT_MODE_WATCH) {
882
				} else if (mode == INPUT_MODE_BREAKPOINT || mode == INPUT_MODE_VARIABLE || mode == INPUT_MODE_WATCH) {
...