telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

`sorting_strategy = "ascending"` and multi select highlighting

Open jamestrew opened this issue 2 years ago • 1 comments

Description

when using sorting_strategy = "ascending" (or a theme that uses it), the toggle_all action has some strange behavior with regards to highlighting entries.

Peek 2023-05-21 17-18 ^ toggling all fails to highlight the initially selected entry (foo.md) fully until I "hover" over it again

I can try to take a look at this bug but I actually never use this action and probably not many other people use this either considering it's not a action mapped by default so it's a low priority for me.

Neovim version

NVIM v0.10.0-dev-19+g339011f59
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system and version

Linux archlinux 6.3.2-arch1-1

Telescope version / branch / rev

master

checkhealth telescope

telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.7.0

Steps to reproduce

  1. nvim -u minimal.lua in a directory with several files/folders
  2. :Telescope find_files
  3. <Tab> to multi-select the first entry
  4. <C-t> to toggle_all, everything but the first entry is now multi-selected as expected
  5. <C-t> again, everything from step 4 is de-selected, but the first entry from step 3, whilst it is multi-selected, highlighting for the filename is not set

Expected behavior

toggle_all should always fully highlight multi-selected entries.

Actual behavior

the multi-selection icon toggles as expected but the rest of the entry line(s) do not highlight as expected

Minimal config

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"https://github.com/folke/lazy.nvim.git",
		lazypath,
	})
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
	-- add any other plugins here
	{
		"nvim-telescope/telescope.nvim",
		dependencies = {
			"nvim-lua/plenary.nvim",
		},
		config = function()
			local actions = require("telescope.actions")
			require("telescope").setup({
				defaults = {
					sorting_strategy = "ascending",
          mappings = {
            ["i"] = {
              ["<C-t>"] = actions.toggle_all,
            },
            ["n"] = {
              ["<C-t>"] = actions.toggle_all,
            }
          }
				},
			})
		end,
	},
}
require("lazy").setup(plugins, {
	root = root .. "/plugins",
})

vim.cmd.colorscheme("habamax")
-- add anything else here

jamestrew avatar May 21 '23 21:05 jamestrew

I've noticed some filtering oddities with ascending results as well

willhansen avatar May 26 '24 14:05 willhansen