diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2021-07-23 17:42:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-23 11:42:37 -0400 |
| commit | 79644ab67731c7ba956c354bf0545282f34e10cc (patch) | |
| tree | e65dbf73b3442ab1aa9fc59fc56a35b4c9edf1e0 /lua/telescope/pickers/highlights.lua | |
| parent | 664690029fdb302bee8d3f27a458383e8477add7 (diff) | |
chore: use stylua for formatting (#1040)
* chore: stylua job and config
* reformat with stylua
Diffstat (limited to 'lua/telescope/pickers/highlights.lua')
| -rw-r--r-- | lua/telescope/pickers/highlights.lua | 56 |
1 files changed, 20 insertions, 36 deletions
diff --git a/lua/telescope/pickers/highlights.lua b/lua/telescope/pickers/highlights.lua index 8378e9b..1be289e 100644 --- a/lua/telescope/pickers/highlights.lua +++ b/lua/telescope/pickers/highlights.lua @@ -1,11 +1,11 @@ local a = vim.api -local log = require('telescope.log') +local log = require "telescope.log" local highlights = {} -local ns_telescope_selection = a.nvim_create_namespace('telescope_selection') -local ns_telescope_multiselection = a.nvim_create_namespace('telescope_mulitselection') -local ns_telescope_entry = a.nvim_create_namespace('telescope_entry') +local ns_telescope_selection = a.nvim_create_namespace "telescope_selection" +local ns_telescope_multiselection = a.nvim_create_namespace "telescope_mulitselection" +local ns_telescope_entry = a.nvim_create_namespace "telescope_entry" local Highlighter = {} Highlighter.__index = Highlighter @@ -41,11 +41,12 @@ function Highlighter:hi_display(row, prefix, display_highlights) end function Highlighter:clear_display() - if not self - or not self.picker - or not self.picker.results_bufnr - or not vim.api.nvim_buf_is_valid(self.picker.results_bufnr) - then + if + not self + or not self.picker + or not self.picker.results_bufnr + or not vim.api.nvim_buf_is_valid(self.picker.results_bufnr) + then return end @@ -66,35 +67,23 @@ function Highlighter:hi_selection(row, caret) local results_bufnr = assert(self.picker.results_bufnr, "Must have a results bufnr") 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_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) end function Highlighter:hi_multiselect(row, is_selected) local results_bufnr = assert(self.picker.results_bufnr, "Must have a results bufnr") if is_selected then - vim.api.nvim_buf_add_highlight( - results_bufnr, ns_telescope_multiselection, "TelescopeMultiSelection", row, 0, -1 - ) + vim.api.nvim_buf_add_highlight(results_bufnr, ns_telescope_multiselection, "TelescopeMultiSelection", row, 0, -1) else local existing_marks = vim.api.nvim_buf_get_extmarks( - results_bufnr, ns_telescope_multiselection, {row, 0}, {row, -1}, {} + results_bufnr, + ns_telescope_multiselection, + { row, 0 }, + { row, -1 }, + {} ) -- This is still kind of weird to me, since it seems like I'm erasing stuff @@ -102,12 +91,7 @@ function Highlighter:hi_multiselect(row, is_selected) if #existing_marks > 0 then log.trace("Clearning row: ", row) - vim.api.nvim_buf_clear_namespace( - results_bufnr, - ns_telescope_multiselection, - row, - row + 1 - ) + vim.api.nvim_buf_clear_namespace(results_bufnr, ns_telescope_multiselection, row, row + 1) end end end |
