From 59fe554259362b9da651f9dee82311975f7dec9f Mon Sep 17 00:00:00 2001 From: Syed Daanish Date: Sun, 1 Feb 2026 20:47:41 +0000 Subject: [PATCH] Fix bar dead code --- TODO.md | 7 +------ include/ui/bar.h | 3 --- src/main.cc | 1 - src/ui/bar.cc | 19 ++++++------------- 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/TODO.md b/TODO.md index ab76869..70e41be 100644 --- a/TODO.md +++ b/TODO.md @@ -19,7 +19,6 @@ Copyright 2025 Syed Daanish - So one lsp being slower wont affect others and fps based reading wont be necessary saving cpu - At which point the main thread can also be blocked on user input or lsp responses and still be fast * [ ] Add mgems for most common things and a ruby library to allow combining true ruby with mruby - - Or revert to cruby and retry with manual linking . maybe it might work? * add command to set and use a file type at runtime * [ ] color alpha in ini files * [ ] Make warning before ctrl+q for saving @@ -29,11 +28,11 @@ Copyright 2025 Syed Daanish * [ ] Ignore comments/strings from parser when auto-indenting. * [ ] **Readme:** Update readme to show ruby based config in detail. * [ ] **UI Refinement:** - * [ ] Allow completion list to be scrolled; show only `x` max items. * [ ] Finish autocomplete box style functions. * [ ] **Documentation UI:** Capture `Ctrl+h` / `Ctrl+l` for scrolling documentation windows. * [ ] Redo hooks as a struct. * [ ] breakdown the render function into smaller functions. + - Might allow for VAI integration easier * Try to make all functions better now that folds have been purged * Cleanup syntax and renderer files @@ -87,8 +86,6 @@ move lsp configs to json and also allow configs for windows-style vs unix-style ### UX -* [ ] **Editor word highlighter:** Do not recompute word under cursor if not changed. - * [ ] **Completion Filtering:** * [ ] Stop filtering case-sensitive. * [ ] Normalize completion edits if local filtering is used. @@ -118,8 +115,6 @@ move lsp configs to json and also allow configs for windows-style vs unix-style ### Visuals, UI & Extensions? -* [ ] **Status Bar:** Complete status bar and command runner. - * [ ] Add color picker/palette. * [ ] **Git:** Add Git integration (status, diffs). diff --git a/include/ui/bar.h b/include/ui/bar.h index 29d935a..61f4f06 100644 --- a/include/ui/bar.h +++ b/include/ui/bar.h @@ -10,11 +10,8 @@ struct Bar { std::string command = ""; std::string log_line = ""; uint32_t cursor = 0; - BarLine bar_line; - std::mutex mtx; void init(Coord screen) { this->screen = screen; } - void work(); void render(); void handle(KeyEvent event); void log(std::string message); diff --git a/src/main.cc b/src/main.cc index 58843e8..0a3af1c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -91,7 +91,6 @@ int main(int argc, char *argv[]) { free(event.c); render: throttle(4ms, editor_worker, editors[current_editor]); - bar.work(); bar.render(); render_editor(editors[current_editor]); throttle(4ms, render); diff --git a/src/ui/bar.cc b/src/ui/bar.cc index 447d8db..79d003c 100644 --- a/src/ui/bar.cc +++ b/src/ui/bar.cc @@ -4,24 +4,16 @@ #include "main.h" #include "syntax/decl.h" -void Bar::work() { - std::lock_guard lock(mtx); +void Bar::log(std::string message) { log_line = message; } + +void Bar::render() { + USING(LSPInstance); Editor *editor = editors[current_editor]; - bar_line = + BarLine bar_line = bar_contents(mode, editor->lang.name, editor->warnings.size(), editor->lsp ? editor->lsp->lsp->command : "", editor->filename, editor->filename, editor->cursor.row + 1, editor->root->line_count + 1, screen.col); -} - -void Bar::log(std::string message) { - std::lock_guard lock(mtx); - log_line = message; -} - -void Bar::render() { - std::lock_guard lock(mtx); - USING(LSPInstance); uint32_t row = screen.row - 2; uint32_t width = screen.col; std::string &line = bar_line.line; @@ -59,6 +51,7 @@ void Bar::render() { void Bar::handle(KeyEvent event) { if (event.key_type == KEY_CHAR && event.len == 1) { if (event.c[0] == 0x1B) { + command = ""; mode = NORMAL; } else if (event.c[0] == '\n' || event.c[0] == '\r') { command = trim(command);