Store the current source filename and use it to pre-fill the breakpoint input buffer

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2026-01-17 01:37:23 +0100
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2026-01-17 01:37:23 +0100
Commit 366ead0dc70410a213eb5745dc869b8df0f036ed (patch)
-rw-r--r-- tdbg.cpp 9
1 files changed, 8 insertions, 1 deletions
diff --git a/tdbg.cpp b/tdbg.cpp
...
619
	bool running = true;
619
	bool running = true;
620
	InputMode mode = INPUT_MODE_NORMAL;
620
	InputMode mode = INPUT_MODE_NORMAL;
621
	std::string input_buffer;
621
	std::string input_buffer;
  
622
	std::string current_source_filename;
622
	std::vector<std::string> log_buffer;
623
	std::vector<std::string> log_buffer;
623
	int log_scroll_offset = 0;
624
	int log_scroll_offset = 0;
624
	int locals_scroll_offset = 0;
625
	int locals_scroll_offset = 0;
...
652
							std::string fullpath;
653
							std::string fullpath;
653
							if (le.GetFileSpec().GetDirectory()) {
654
							if (le.GetFileSpec().GetDirectory()) {
654
								fullpath = std::string(le.GetFileSpec().GetDirectory()) + "/" + le.GetFileSpec().GetFilename();
655
								fullpath = std::string(le.GetFileSpec().GetDirectory()) + "/" + le.GetFileSpec().GetFilename();
  
656
								current_source_filename = le.GetFileSpec().GetFilename();
655
							} else {
657
							} else {
656
								fullpath = le.GetFileSpec().GetFilename();
658
								fullpath = le.GetFileSpec().GetFilename();
  
659
								current_source_filename = fullpath;
657
							}
660
							}
658
							const std::vector<std::string>& lines = source_cache.get_lines(fullpath);
661
							const std::vector<std::string>& lines = source_cache.get_lines(fullpath);
659
							int total_lines = (int)lines.size();
662
							int total_lines = (int)lines.size();
...
701
						}
704
						}
702
					} else if (ev.ch == 'b') {
705
					} else if (ev.ch == 'b') {
703
						mode = INPUT_MODE_BREAKPOINT;
706
						mode = INPUT_MODE_BREAKPOINT;
704
						input_buffer.clear();
707
						if (!current_source_filename.empty()) {
  
708
							input_buffer = current_source_filename + ":";
  
709
						} else {
  
710
							input_buffer.clear();
  
711
						}
705
					} else if (ev.ch == 'p') {
712
					} else if (ev.ch == 'p') {
706
						mode = INPUT_MODE_VARIABLE;
713
						mode = INPUT_MODE_VARIABLE;
707
						input_buffer.clear();
714
						input_buffer.clear();
...