File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -864,12 +864,17 @@ end
864
864
--- @return Date | nil
865
865
function OrgMappings :_get_date_under_cursor (col_offset )
866
866
col_offset = col_offset or 0
867
- local item = Files .get_closest_headline ()
868
867
local col = vim .fn .col (' .' ) + col_offset
869
868
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 )
869
+ local item = Files .get_closest_headline ()
870
+ local dates = {}
871
+ if item then
872
+ 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
873
878
874
879
if # dates == 0 then
875
880
return nil
You can’t perform that action at this time.
0 commit comments