From 0063db338f912a0cf961a738899b3757cba2340b Mon Sep 17 00:00:00 2001 From: pommicket Date: Thu, 11 May 2023 11:51:10 -0400 Subject: :jump-to-build-error setting --- build.c | 11 ++++++++--- config.c | 1 + main.c | 3 +-- ted.cfg | 2 ++ ted.h | 1 + 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build.c b/build.c index 9d7e3ad..d4804b2 100644 --- a/build.c +++ b/build.c @@ -199,6 +199,8 @@ static bool is_source_path(char32_t c) { // make sure you set ted->build_dir before running this! void build_check_for_errors(Ted *ted) { + const Settings *settings = ted_active_settings(ted); + TextBuffer *buffer = &ted->build_buffer; arr_clear(ted->build_errors); for (u32 line_idx = 0; line_idx < buffer->nlines; ++line_idx) { @@ -298,9 +300,12 @@ void build_check_for_errors(Ted *ted) { } } } - // go to the first error (if there is one) - ted->build_error = 0; - build_go_to_error(ted); + + if (settings->jump_to_build_error) { + // go to the first error (if there is one) + ted->build_error = 0; + build_go_to_error(ted); + } } void build_frame(Ted *ted, float x1, float y1, float x2, float y2) { diff --git a/config.c b/config.c index 5baa772..0da3a19 100644 --- a/config.c +++ b/config.c @@ -99,6 +99,7 @@ static const SettingBool settings_bool[] = { {"highlight-auto", &settings_zero.highlight_auto, true}, {"save-backup", &settings_zero.save_backup, true}, {"crlf-windows", &settings_zero.crlf_windows, true}, + {"jump-to-build-error", &settings_zero.jump_to_build_error, true}, }; static const SettingU8 settings_u8[] = { {"tab-width", &settings_zero.tab_width, 1, 100, true}, diff --git a/main.c b/main.c index 23d0d07..123e247 100644 --- a/main.c +++ b/main.c @@ -1,9 +1,8 @@ /* TODO: -- option for whether to jump to build error when the build command finishes, and maybe :build-jump, :build-nojump commands -- highlight TODO, FIXME, XXX, others(?) in comments - :go-to-matching-bracket FUTURE FEATURES: +- highlight TODO, FIXME, XXX, others(?) in comments - autodetect indentation (tabs vs spaces) - better undo chaining (dechain on backspace?) - font setting & support for multiple fonts to cover more characters diff --git a/ted.cfg b/ted.cfg index 408c9b3..83662da 100644 --- a/ted.cfg +++ b/ted.cfg @@ -35,6 +35,8 @@ build-default-command = make # [/my/fav/project//core] # build-command = "supermake --treble-clef -rxvt" build-command = "" +# whether or not to jump to the first build error when the build completes. +jump-to-build-error = yes # restore previously opened files when ted is launched? restore-session = on # show autocomplete menu when a trigger character (e.g. '.') is typed (LSP only) diff --git a/ted.h b/ted.h index e1a571b..de00472 100644 --- a/ted.h +++ b/ted.h @@ -273,6 +273,7 @@ typedef struct { bool vsync; bool save_backup; bool crlf_windows; + bool jump_to_build_error; KeyCombo hover_key; KeyCombo highlight_key; u8 tab_width; -- cgit v1.2.3