We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6eee479 commit 1f103a9Copy full SHA for 1f103a9
lua/orgmode/org/mappings.lua
@@ -864,12 +864,17 @@ end
864
---@return Date|nil
865
function OrgMappings:_get_date_under_cursor(col_offset)
866
col_offset = col_offset or 0
867
- local item = Files.get_closest_headline()
868
local col = vim.fn.col('.') + col_offset
869
local line = vim.fn.line('.')
870
- local dates = vim.tbl_filter(function(date)
871
- return date.range:is_in_range(line, col)
872
- end, item.dates)
+ local item = Files.get_closest_headline()
+ local dates = {}
+ if item then
+ dates = vim.tbl_filter(function(date)
873
+ return date.range:is_in_range(line, col)
874
+ end, item.dates)
875
+ else
876
+ dates = Date.parse_all_from_line(vim.fn.getline('.'), line)
877
+ end
878
879
if #dates == 0 then
880
return nil
0 commit comments