From 8eeef59a98086a51d1969ff36d48971b2c656cb2 Mon Sep 17 00:00:00 2001 From: arthur barraux Date: Tue, 26 May 2026 10:32:23 +0200 Subject: [PATCH] clean working dir --- config/init.lisp | 1 + include/builtins.h | 1 + meson.build | 2 -- src/builtins.c | 5 ++--- src/init.c | 1 + src/output.c | 29 +++++++++++++++++++++++++++++ 6 files changed, 34 insertions(+), 5 deletions(-) diff --git a/config/init.lisp b/config/init.lisp index 734fcea..f593733 100644 --- a/config/init.lisp +++ b/config/init.lisp @@ -90,3 +90,4 @@ (map-key "CTRL-k" editor-cut-end-line "no-prefix") (map-key "a" editor-move-cursor-beg-buffer "user") (map-key "z" editor-move-cursor-end-buffer "user") +;; (map-key "x" editor-auto-complete "user") diff --git a/include/builtins.h b/include/builtins.h index 89c3fe7..5dc9d7d 100644 --- a/include/builtins.h +++ b/include/builtins.h @@ -53,6 +53,7 @@ Lisp editorMoveEndBuffer(Lisp args, LispError *e, LispContext ctx); // Other +Lisp editorAutoComplete(Lisp args, LispError *e, LispContext ctx); void free_structs(void); diff --git a/meson.build b/meson.build index 929d326..9fec757 100644 --- a/meson.build +++ b/meson.build @@ -30,6 +30,4 @@ src_files = files( executable('beluga', src_files, dependencies: [m] -) - dependencies: [m] ) diff --git a/src/builtins.c b/src/builtins.c index 049f6c2..810d64b 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -15,7 +15,6 @@ #include "../include/input.h" #include "../include/terminal.h" #include "../include/split_screen.h" -#include "../include/completion.h" #include #include @@ -556,6 +555,6 @@ Lisp editorMoveEndBuffer(Lisp args, LispError *e, LispContext ctx) Lisp editorAutoComplete(Lisp args, LispError *e, LispContext ctx) { - createContextBuffer(E.cursor_x - 2, E.cursor_y + 1, "hello"); + // createContextBuffer(E.cursor_x - 2, E.cursor_y + 1, "hello"); return lisp_null(); -} \ No newline at end of file +} diff --git a/src/init.c b/src/init.c index d380cfc..7ff5864 100644 --- a/src/init.c +++ b/src/init.c @@ -49,6 +49,7 @@ void initBuiltins() { registerBuiltin("editor-cut-end-line", editorCutEndLine); registerBuiltin("editor-move-cursor-beg-buffer", editorMoveBegBuffer); registerBuiltin("editor-move-cursor-end-buffer", editorMoveEndBuffer); + registerBuiltin("editor-auto-complete", editorAutoComplete); } void initConfig() { diff --git a/src/output.c b/src/output.c index 4a65a31..41d87c6 100644 --- a/src/output.c +++ b/src/output.c @@ -328,6 +328,35 @@ void editorDrawMessageBar(struct abuf* ab) } } +void editorDrawContextBuffer(struct abuf* ab) +{ + int pos_len; + char pos_buf[1024]; + int i, j; + + if (!E.context_buffers) + return; + + appDebug("Printing context"); + + for (i = 0; i < E.context_buffers->height; ++i) + { + if (E.context_buffers->editor_y + i + 1 > 0) + { + pos_len = snprintf(pos_buf, sizeof(pos_buf), "\x1b[%d;%dH", + E.context_buffers->editor_y + i + 1, E.context_buffers->editor_x - 2); + abAppend(ab, pos_buf, pos_len); + + // Apply background color (6 bytes for RGB format) + abAppend(ab, E.theme.BACKGROUND_COLOR, (int) strlen(E.theme.BACKGROUND_COLOR)); + abAppend(ab, "|", 1); + abAppend(ab, E.context_buffers->rows->chars, E.context_buffers->rows->size); + abAppend(ab, "|", 1); + } + } + free(E.context_buffers); + E.context_buffers = NULL; +} /** * @brief Performs complete screen refresh and buffer synchronization