Skip to content

Commit

Permalink
break: changed the results window highlight to always be full width (#…
Browse files Browse the repository at this point in the history
…1312)

Can be changed back by setting 
telescope.setup {
  defaults = {
    hl_result_eol = false,
  }
}
  • Loading branch information
TC72 committed Oct 29, 2021
1 parent 02a02f7 commit 3b9ac8e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
7 changes: 7 additions & 0 deletions doc/telescope.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ telescope.setup({opts}) *telescope.setup()*

Default: function that shows current count / all

*telescope.defaults.hl_result_eol*
hl_result_eol: ~
Changes if the highlight for the selected item in the results
window is always the full width of the window

Default: true

*telescope.defaults.dynamic_preview_title*
dynamic_preview_title: ~
Will change the title of the preview window dynamically, where it
Expand Down
10 changes: 10 additions & 0 deletions lua/telescope/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,16 @@ append(
Default: function that shows current count / all]]
)

append(
"hl_result_eol",
true,
[[
Changes if the highlight for the selected item in the results
window is always the full width of the window
Default: true]]
)

append(
"dynamic_preview_title",
false,
Expand Down
9 changes: 8 additions & 1 deletion lua/telescope/pickers/highlights.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local a = vim.api
local log = require "telescope.log"
local conf = require("telescope.config").values

local highlights = {}

Expand Down Expand Up @@ -69,7 +70,13 @@ function Highlighter:hi_selection(row, caret)
a.nvim_buf_clear_namespace(results_bufnr, ns_telescope_selection, 0, -1)
a.nvim_buf_add_highlight(results_bufnr, ns_telescope_selection, "TelescopeSelectionCaret", row, 0, #caret)

a.nvim_buf_add_highlight(results_bufnr, ns_telescope_selection, "TelescopeSelection", row, #caret, -1)
a.nvim_buf_set_extmark(
results_bufnr,
ns_telescope_selection,
row,
#caret,
{ end_line = row + 1, hl_eol = conf.hl_result_eol, hl_group = "TelescopeSelection" }
)
end

function Highlighter:hi_multiselect(row, is_selected)
Expand Down

0 comments on commit 3b9ac8e

Please sign in to comment.