From 756ad1da4aed5191129e0dd2b43b8a8912548145 Mon Sep 17 00:00:00 2001 From: NicolasGB Date: Mon, 27 Oct 2025 09:58:18 +0100 Subject: [PATCH] fix(describe): Handle "C" case status in files --- lua/jj/cmd.lua | 4 +++- lua/jj/utils.lua | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/jj/cmd.lua b/lua/jj/cmd.lua index eaa57f9..377276d 100644 --- a/lua/jj/cmd.lua +++ b/lua/jj/cmd.lua @@ -269,6 +269,7 @@ local function run_floating(cmd) PAGER = "cat", DELTA_PAGER = "cat", COLORTERM = "truecolor", + DFT_BACKGROUND = "light", }, on_stdout = function(_, data) if not vim.api.nvim_buf_is_valid(state.floating_buf) then @@ -424,6 +425,7 @@ local function run(cmd) PAGER = "cat", DELTA_PAGER = "cat", COLORTERM = "truecolor", + DFT_BACKGROUND = "light", }, on_stdout = function(_, data) if not vim.api.nvim_buf_is_valid(state.buf) or not state.chan then @@ -549,7 +551,7 @@ local function execute_describe(description) return end - -- Use --stdin to properly handle multi-line descriptions and special characters + -- Use --stdin to properly handle multi-line and special characters local _, success = utils.execute_command("jj describe --stdin", "Failed to describe", description) if success then utils.notify("Description set.", vim.log.levels.INFO) diff --git a/lua/jj/utils.lua b/lua/jj/utils.lua index 6647954..0d5c60f 100644 --- a/lua/jj/utils.lua +++ b/lua/jj/utils.lua @@ -167,7 +167,7 @@ function M.get_status_files() local files = {} -- Parse jj status output: "M filename", "A filename", "D filename", "R old => new" for line in result:gmatch("[^\r\n]+") do - local status, file = line:match("^([MADR])%s+(.+)$") + local status, file = line:match("^([MADRC])%s+(.+)$") if status and file then table.insert(files, { status = status, file = file }) end @@ -250,12 +250,12 @@ function M.open_ephemeral_buffer(initial_text, on_done) }) -- Then check for status indicators and highlight the rest of the line - local status_pos = line:find("[MADR] ", 4) -- Find status after "JJ:" + local status_pos = line:find("[MADRC] ", 4) -- Find status after "JJ:" if status_pos then local status = line:sub(status_pos, status_pos) -- Get the status character local hl_group = nil - if status == "A" then + if status == "A" or status == "C" then hl_group = "JJAdded" elseif status == "M" then hl_group = "JJModified"