diff --git a/lazy-lock.json b/lazy-lock.json index 57d6840..1fdb3e8 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,7 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" }, - "baleia.nvim": { "branch": "main", "commit": "32617940adb2eea56e85a64883a19961ceac9641" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, diff --git a/lua/plugins/flutter.lua b/lua/plugins/flutter.lua index e5c0d9b..4d31cc7 100644 --- a/lua/plugins/flutter.lua +++ b/lua/plugins/flutter.lua @@ -5,37 +5,23 @@ return { dependencies = { "nvim-lua/plenary.nvim", "stevearc/dressing.nvim", - "m00qek/baleia.nvim", }, config = function() vim.opt.termguicolors = true vim.env.FLUTTER_FORCE_COLOR = "1" - local baleia = require("baleia").setup({ - strip_ansi_codes = true, - }) - - - - vim.api.nvim_create_autocmd("BufWinEnter", { - pattern = "*__FLUTTER_DEV_LOG__*", - callback = function(args) - local bufnr = args.buf - - if not vim.bo[bufnr].modifiable then - vim.bo[bufnr].modifiable = true - end - - baleia.automatically(bufnr) - end, - }) - - vim.api.nvim_create_autocmd("OptionSet", { - pattern = "modifiable", - callback = function(args) - local bufnr = args.buf - if not vim.bo[bufnr].modifiable then - vim.bo[bufnr].modifiable = true + vim.api.nvim_create_autocmd({ "TextChanged", "BufWinEnter" }, { + pattern = "*__FLUTTER_DEV_LOG__*", -- Default name for flutter-tools logs + callback = function() + local buf = vim.api.nvim_get_current_buf() + -- Check if we are in the log buffer + if vim.bo[buf].filetype == "log" or vim.fn.bufname(buf):match("flutter%-dev%.log") then + local win = vim.api.nvim_get_current_win() + local last_line = vim.api.nvim_buf_line_count(buf) + -- Only scroll if we aren't currently in Insert mode + if vim.api.nvim_get_mode().mode ~= 'i' then + vim.api.nvim_win_set_cursor(win, { last_line, 0 }) + end end end, }) @@ -69,28 +55,6 @@ return { }, }) - -- Some Flutter log lines include ANSI start codes but no explicit reset. - -- Baleia keeps style state across lines, so missing reset can "bleed" - -- colors into following lines. Normalize those log lines first. - do - local ok, flutter_log = pcall(require, "flutter-tools.log") - if ok and flutter_log and type(flutter_log.log) == "function" then - local raw_log = flutter_log.log - local ansi_pattern = "\27%[[0-9;]*m" - local ansi_reset = "\27[0m" - - flutter_log.log = function(data) - if type(data) == "string" then - local has_ansi = data:find(ansi_pattern) ~= nil - local has_reset = data:find("\27%[0m") ~= nil - if has_ansi and not has_reset then - data = data .. ansi_reset - end - end - raw_log(data) - end - end - end -- Custom Shorthand Commands local user_command = vim.api.nvim_create_user_command