From 477819a6344bb788dead001a04f7929eade591e2 Mon Sep 17 00:00:00 2001 From: DarthMooMancer <107283522+DarthMooMancer@users.noreply.github.com> Date: Mon, 10 Mar 2025 13:47:36 -0400 Subject: [PATCH] Update c.lua --- lua/Polydev/c.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/Polydev/c.lua b/lua/Polydev/c.lua index 58924fd..e2b31d1 100644 --- a/lua/Polydev/c.lua +++ b/lua/Polydev/c.lua @@ -223,6 +223,7 @@ public class %s { end) end +-- Compile C files -- Compile C files function M.build() vim.ui.input({ prompt = "Enter project name: " }, function(project_name) @@ -234,6 +235,9 @@ function M.build() -- Open the terminal and capture the output of the compile command local term_buf, term_win = M.open_float_terminal(compile_command) + -- Make the terminal buffer modifiable before updating its contents + vim.api.nvim_buf_set_option(term_buf, "modifiable", true) + -- Check if there was an error during the compilation local compile_status = vim.fn.system(compile_command) @@ -245,6 +249,9 @@ function M.build() -- Compilation successful message vim.api.nvim_buf_set_lines(term_buf, 0, -1, false, {"Compilation successful!"}) end + + -- Optionally make the buffer non-modifiable again after updating + vim.api.nvim_buf_set_option(term_buf, "modifiable", false) end) end