fix: Think I fixed the weird movements
This commit is contained in:
@@ -72,7 +72,7 @@ function Finder:_find(prompt, process_result, process_complete)
|
|||||||
self.job:shutdown()
|
self.job:shutdown()
|
||||||
end
|
end
|
||||||
|
|
||||||
log.info("Finding...")
|
log.trace("Finding...")
|
||||||
if self.static and self.done then
|
if self.static and self.done then
|
||||||
log.info("Using previous results")
|
log.info("Using previous results")
|
||||||
for _, v in ipairs(self._cached_lines) do
|
for _, v in ipairs(self._cached_lines) do
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
return require('plenary.log').new {
|
return require('plenary.log').new {
|
||||||
plugin = 'telescope',
|
plugin = 'telescope',
|
||||||
level = 'debug',
|
level = 'info',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,28 +237,21 @@ function Picker:find(opts)
|
|||||||
self.manager:add_entry(sort_score, entry)
|
self.manager:add_entry(sort_score, entry)
|
||||||
end
|
end
|
||||||
|
|
||||||
local process_complete = vim.schedule_wrap(function()
|
local process_complete = function()
|
||||||
self:set_selection(self:get_selection_row())
|
self:set_selection(self:get_selection_row())
|
||||||
|
|
||||||
local worst_line = self.max_results - self.manager.num_results()
|
local worst_line = self.max_results - self.manager.num_results()
|
||||||
if worst_line == 0 then
|
if worst_line <= 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local empty_lines = utils.repeated_table(worst_line, "")
|
vim.schedule(function()
|
||||||
vim.api.nvim_buf_set_lines(results_bufnr, 0, worst_line, false, empty_lines)
|
local empty_lines = utils.repeated_table(worst_line, "")
|
||||||
|
vim.api.nvim_buf_set_lines(results_bufnr, 0, worst_line, false, empty_lines)
|
||||||
|
|
||||||
log.debug("Worst Line after process_complete: %s", worst_line, results_bufnr)
|
log.trace("Worst Line after process_complete: %s", worst_line, results_bufnr)
|
||||||
|
end)
|
||||||
-- local fun = require('fun')
|
end
|
||||||
-- local zip = fun.zip
|
|
||||||
-- local tomap = fun.tomap
|
|
||||||
|
|
||||||
-- log.trace("%s", tomap(zip(
|
|
||||||
-- a.nvim_buf_get_lines(results_bufnr, worst_line, self.max_results, false),
|
|
||||||
-- self.line_scores
|
|
||||||
-- )))
|
|
||||||
end)
|
|
||||||
|
|
||||||
local ok, msg = pcall(function()
|
local ok, msg = pcall(function()
|
||||||
return finder(prompt, process_result, process_complete)
|
return finder(prompt, process_result, process_complete)
|
||||||
|
|||||||
@@ -222,6 +222,15 @@ describe('Sorters', function()
|
|||||||
assert(exact_match < ok_match)
|
assert(exact_match < ok_match)
|
||||||
assert(ok_match < no_match)
|
assert(ok_match < no_match)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('sorts multiple finds better', function()
|
||||||
|
local sorter = require('telescope.sorters').get_norcalli_sorter()
|
||||||
|
|
||||||
|
local multi_match = sorter:score('generics', 'exercises/generics/generics2.rs')
|
||||||
|
local one_match = sorter:score('abcdef', 'exercises/generics/README.md')
|
||||||
|
|
||||||
|
assert(multi_match < one_match)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user