Skip to content

Commit 9bfba3d

Browse files
feat(agenda): Show grid without times for remove-range-match
Addresses #1053
1 parent 638b2b4 commit 9bfba3d

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

lua/orgmode/agenda/types/agenda.lua

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ function OrgAgendaType:render(bufnr, current_line)
326326
return self.view
327327
end
328328

329-
---@param grid_line { real_date: OrgDate, is_same_day: boolean, is_now: boolean }
329+
---@param grid_line { real_date: OrgDate, is_same_day: boolean, is_now: boolean, is_placeholder?: boolean }
330330
---@param agenda_day OrgAgendaDay
331331
---@return OrgAgendaLine
332332
function OrgAgendaType:_build_time_grid_line(grid_line, agenda_day)
@@ -340,9 +340,16 @@ function OrgAgendaType:_build_time_grid_line(grid_line, agenda_day)
340340
line:add_token(AgendaLineToken:new({
341341
content = ' ' .. utils.pad_right(' ', agenda_day.category_length),
342342
}))
343-
line:add_token(AgendaLineToken:new({
344-
content = grid_line.real_date:format_time() .. ' ' .. config.org_agenda_time_grid.time_separator,
345-
}))
343+
if grid_line.is_placeholder then
344+
line:add_token(AgendaLineToken:new({
345+
-- Replace hh:mm ....... with spaces to keep alignment
346+
content = (' '):rep(5 + vim.api.nvim_strwidth(config.org_agenda_time_grid.time_separator) + 1),
347+
}))
348+
else
349+
line:add_token(AgendaLineToken:new({
350+
content = grid_line.real_date:format_time() .. ' ' .. config.org_agenda_time_grid.time_separator,
351+
}))
352+
end
346353
line:add_token(AgendaLineToken:new({
347354
content = grid_line.is_now and config.org_agenda_current_time_string or config.org_agenda_time_grid.time_label,
348355
}))
@@ -439,6 +446,12 @@ function OrgAgendaType:_prepare_grid_lines(date_range, agenda_day)
439446
if remove_range_match then
440447
for _, range in ipairs(agenda_items_with_range_time) do
441448
if date >= range.from and date < range.to then
449+
table.insert(grid_lines, {
450+
real_date = date,
451+
is_same_day = true,
452+
is_now = false,
453+
is_placeholder = true,
454+
})
442455
goto continue
443456
end
444457
end

0 commit comments

Comments
 (0)