Skip to content

Commit

Permalink
more ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Badragan committed May 4, 2024
1 parent 7438dab commit a04b50a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lua/grug-far/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ local function render(params, context)

renderResults({
buf = buf,
minLineNr = 8,
minLineNr = 5,
inputs = inputs
}, context)
end
Expand Down
10 changes: 6 additions & 4 deletions lua/grug-far/render/results.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ local function renderHeader(buf, context, headerRow, newStatus)
end_row = headerRow,
end_col = 0,
virt_lines = {
{ { " 󱎸 ────────────────────────────────────────────────────────── " .. getStatusText(status), 'SpecialComment' } },
{ { " 󱎸 ─────────────────────────────────────────────────────────────────────────────── " .. getStatusText(status), 'SpecialComment' } },
},
virt_lines_leftcol = true,
virt_lines_above = true,
Expand Down Expand Up @@ -87,7 +87,6 @@ local function renderResults(params, context)
headerRow = minLineNr
end

-- TODO (sbadragan): results can move past header when pressing backspace, not sure we can do anything about it
renderHeader(buf, context, headerRow)

if vim.deep_equal(inputs, lastInputs) then
Expand All @@ -99,14 +98,17 @@ local function renderResults(params, context)
renderHeader(buf, context, headerRow, newStatus)
end

-- TODO (sbadragan): print actual rg command being executed for clarity
-- TODO (sbadragan): figure out how to "commit" the replacement
-- TODO (sbadragan): highlight the results properly
asyncRenderResultList = asyncRenderResultList or utils.debounce(renderResultList, context.options.debounceMs)
asyncRenderResultList({
inputs = inputs,
on_start = function()
updateStatus(#inputs.search > 0 and { status = 'fetching_chunk', chunk = 1 } or getInitialStatus())
-- remove all lines after heading
vim.api.nvim_buf_set_lines(buf, headerRow, -1, false, {})
lastErrorLine = headerRow
vim.api.nvim_buf_set_lines(buf, headerRow, -1, false, { "" })
lastErrorLine = headerRow + 1
end,
on_fetch_chunk = function(chunk_lines)
updateStatus({ status = 'fetching_chunk', chunk = status.chunk and status.chunk + 1 or 2 })
Expand Down

0 comments on commit a04b50a

Please sign in to comment.