Skip to content

Commit 8d46250

Browse files
[grok-nvim] 0.1.1-108.2-p: UI polish: testing new border, grok background, and prompt background
1 parent e550019 commit 8d46250

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

lua/grok/ui.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ M.tabs = { "1: Grok", "2: Keymaps", "3: Config" }
1414
local ui_state = require("grok.ui.state")
1515
M.current_tab = ui_state.state.current_tab
1616

17-
-- Fixed highlights for v0.1.1 polish
17+
-- Fixed highlights for v0.1.1 polish (Grok UI-inspired)
18+
vim.api.nvim_set_hl(0, "GrokChatWindow", { bg = "#000000" }) -- Solid black for entire chat
19+
vim.api.nvim_set_hl(0, "GrokAssistant", { bg = "#000000", fg = "#ffffff" }) -- Black bg, white fg for Grok
1820
vim.api.nvim_set_hl(0, "GrokUser", { bg = "#333333", fg = "#ffffff" }) -- Charcoal gray bg, white fg for user
19-
vim.api.nvim_set_hl(0, "GrokAssistant", { bg = "#1a1a1a", fg = "#ffffff" }) -- Dark black bg, white fg for Grok
20-
vim.api.nvim_set_hl(0, "GrokChatWindow", { bg = "#2d2d2d" }) -- Neutral chat window bg (dark grey)
21+
vim.api.nvim_set_hl(0, "GrokHeader", { bg = "#666666", fg = "#ffffff" }) -- Lighter gray for header
2122

2223
M.open_chat_window = require("grok.ui.window").open_chat_window
2324
M.append_response = require("grok.ui.render").append_response

lua/grok/ui/render.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ local function render_tab_content(buf, callback)
5353
require("grok.util").auto_scroll(buf, require("grok.ui").current_win) -- v0.1.1 Auto-scroll
5454
end
5555
render_tab_header(buf) -- Refresh header
56+
-- Apply header highlight
57+
vim.api.nvim_buf_add_highlight(buf, require("grok.ui").ns, "GrokHeader", 0, 0, -1)
5658
vim.api.nvim_buf_set_option(buf, "modifiable", false)
5759
else
5860
local content_lines = {}
@@ -78,7 +80,8 @@ local function render_tab_content(buf, callback)
7880
}
7981
end
8082
vim.api.nvim_buf_set_lines(buf, 1, -1, false, content_lines)
81-
render_tab_header(buf) -- Refresh header before locking
83+
render_tab_header(buf) -- Refresh header
84+
vim.api.nvim_buf_add_highlight(buf, require("grok.ui").ns, "GrokHeader", 0, 0, -1)
8285
vim.api.nvim_buf_set_option(buf, "modifiable", false) -- Lock non-chat tabs
8386
end
8487
end

lua/grok/util.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,16 @@ function M.create_floating_input(opts)
6969
row = row,
7070
col = col,
7171
style = "minimal",
72-
border = "rounded",
72+
border = {
73+
{ "", "GrokUser" },
74+
{ "", "GrokUser" },
75+
{ "", "GrokUser" },
76+
{ "", "GrokUser" },
77+
{ "", "GrokUser" },
78+
{ "", "GrokUser" },
79+
{ "", "GrokUser" },
80+
{ "", "GrokUser" },
81+
}, -- Thin near-white border
7382
title = "Enter Query (0/" .. max_length .. ")",
7483
}
7584
local win = vim.api.nvim_open_win(buf, true, win_opts)
@@ -135,15 +144,6 @@ function M.create_floating_input(opts)
135144
vim.api.nvim_command("startinsert")
136145
end
137146

138-
function M.submit_input()
139-
local buf = vim.api.nvim_get_current_buf()
140-
local text = table.concat(vim.api.nvim_buf_get_lines(buf, 0, -1, false), "\n")
141-
local ok, callback = pcall(vim.api.nvim_buf_get_var, buf, "grok_callback")
142-
vim.api.nvim_win_close(0, true)
143-
if ok and callback then
144-
callback(text)
145-
end
146-
end
147147
function M.submit_input()
148148
local buf = vim.api.nvim_get_current_buf()
149149
local text = table.concat(vim.api.nvim_buf_get_lines(buf, 0, -1, false), "\n")

0 commit comments

Comments
 (0)