feat: Add highlight for selection caret (#135)

* Add highlight for selection caret

* add default hl

* remove highlight overlap
This commit is contained in:
Alvaro Muñoz
2020-10-02 17:26:11 +02:00
committed by GitHub
parent efffe0b533
commit c414e5f869
2 changed files with 12 additions and 2 deletions

View File

@@ -705,7 +705,8 @@ function Picker:set_selection(row)
end end
end end
local display = '> ' .. (a.nvim_buf_get_lines(results_bufnr, row, row + 1, false)[1] or ''):sub(3) local caret = '>'
local display = string.format('%s %s', caret, (a.nvim_buf_get_lines(results_bufnr, row, row + 1, false)[1] or ''):sub(3))
-- TODO: You should go back and redraw the highlights for this line from the sorter. -- TODO: You should go back and redraw the highlights for this line from the sorter.
-- That's the only smart thing to do. -- That's the only smart thing to do.
@@ -719,9 +720,17 @@ function Picker:set_selection(row)
a.nvim_buf_add_highlight( a.nvim_buf_add_highlight(
results_bufnr, results_bufnr,
ns_telescope_selection, ns_telescope_selection,
'TelescopeSelection', 'TelescopeSelectionCaret',
row, row,
0, 0,
#caret
)
a.nvim_buf_add_highlight(
results_bufnr,
ns_telescope_selection,
'TelescopeSelection',
row,
#caret,
-1 -1
) )

View File

@@ -1,6 +1,7 @@
" Sets the highlight for selected items within the picker. " Sets the highlight for selected items within the picker.
highlight default link TelescopeSelection Visual highlight default link TelescopeSelection Visual
highlight default link TelescopeSelectionCaret TelescopeSelection
highlight default link TelescopeMultiSelection Type highlight default link TelescopeMultiSelection Type
" "Normal" in the floating windows created by telescope. " "Normal" in the floating windows created by telescope.