feat: recalculate picker layout on VimResized (#959)

* WIP: recalculate picker layout on `VimResized`

* refactor: `popup.resize` -> `popup.move`

* fix: scroll to the correct place after resize

* fix: update positioning in results buffer

* fix: completely redraw results buffer on resize

* fix: handle preview enable/disable

* fix: work with scrolling

* docs: add plan for `toggle_padding`

* refactor: factor out creation of picker windows

* refactor: pass highlights directly to popup_create

* refactor: remove lines update and factor out scroll repositioning

Co-authored-by: Github Actions <actions@github>
This commit is contained in:
Luke Kershaw
2021-10-20 11:06:10 +01:00
committed by GitHub
parent 9cad3a4a5d
commit adfbd616c6
2 changed files with 142 additions and 45 deletions

View File

@@ -774,7 +774,7 @@ builtin.treesitter() *builtin.treesitter()*
hl_group
builtin.current_buffer_fuzzy_find({opts})*builtin.current_buffer_fuzzy_find()*
builtin.current_buffer_fuzzy_find({opts}) *builtin.current_buffer_fuzzy_find()*
Live fuzzy search inside of the currently open buffer
@@ -1390,7 +1390,7 @@ builtin.lsp_workspace_symbols({opts}) *builtin.lsp_workspace_symbols()*
with hl_group
builtin.lsp_dynamic_workspace_symbols({opts})*builtin.lsp_dynamic_workspace_symbols()*
builtin.lsp_dynamic_workspace_symbols({opts}) *builtin.lsp_dynamic_workspace_symbols()*
Dynamically lists LSP for all workspace symbols
- Default keymaps:
- `<C-l>`: show autocompletion menu to prefilter your query by type of
@@ -1439,7 +1439,7 @@ builtin.lsp_document_diagnostics({opts}) *builtin.lsp_document_diagnostics()*
in Results
builtin.lsp_workspace_diagnostics({opts})*builtin.lsp_workspace_diagnostics()*
builtin.lsp_workspace_diagnostics({opts}) *builtin.lsp_workspace_diagnostics()*
Lists LSP diagnostics for the current workspace if supported, otherwise
searches in all open buffers
- Fields:
@@ -1782,7 +1782,7 @@ actions.move_selection_next({prompt_bufnr}) *actions.move_selection_next()*
{prompt_bufnr} (number) The prompt bufnr
actions.move_selection_previous({prompt_bufnr})*actions.move_selection_previous()*
actions.move_selection_previous({prompt_bufnr}) *actions.move_selection_previous()*
Move the selection to the previous entry
@@ -1798,7 +1798,7 @@ actions.move_selection_worse({prompt_bufnr}) *actions.move_selection_worse()*
{prompt_bufnr} (number) The prompt bufnr
actions.move_selection_better({prompt_bufnr})*actions.move_selection_better()*
actions.move_selection_better({prompt_bufnr}) *actions.move_selection_better()*
Move the selection to the entry that has a better score
@@ -2067,7 +2067,7 @@ actions.delete_buffer({prompt_bufnr}) *actions.delete_buffer()*
{prompt_bufnr} (number) The prompt bufnr
actions.cycle_previewers_next({prompt_bufnr})*actions.cycle_previewers_next()*
actions.cycle_previewers_next({prompt_bufnr}) *actions.cycle_previewers_next()*
Cycle to the next previewer if there is one available.
This action is not mapped on default.
@@ -2076,7 +2076,7 @@ actions.cycle_previewers_next({prompt_bufnr})*actions.cycle_previewers_next()*
{prompt_bufnr} (number) The prompt bufnr
actions.cycle_previewers_prev({prompt_bufnr})*actions.cycle_previewers_prev()*
actions.cycle_previewers_prev({prompt_bufnr}) *actions.cycle_previewers_prev()*
Cycle to the previous previewer if there is one available.
This action is not mapped on default.
@@ -2085,7 +2085,7 @@ actions.cycle_previewers_prev({prompt_bufnr})*actions.cycle_previewers_prev()*
{prompt_bufnr} (number) The prompt bufnr
actions.remove_selected_picker({prompt_bufnr})*actions.remove_selected_picker()*
actions.remove_selected_picker({prompt_bufnr}) *actions.remove_selected_picker()*
Removes the selected picker in |builtin.pickers|.
This action is not mapped by default and only intended for
|builtin.pickers|.
@@ -2125,7 +2125,7 @@ action_state.get_current_line() *action_state.get_current_line()*
action_state.get_current_picker({prompt_bufnr})*action_state.get_current_picker()*
action_state.get_current_picker({prompt_bufnr}) *action_state.get_current_picker()*
Gets the current picker
@@ -2145,7 +2145,7 @@ vertical split, etc. Instead of making users have to overwrite EACH of those
every time they want to change this behavior, they can instead replace the
`set` itself and then it will work great and they're done.
action_set.shift_selection({prompt_bufnr}, {change})*action_set.shift_selection()*
action_set.shift_selection({prompt_bufnr}, {change}) *action_set.shift_selection()*
Move the current selection of a picker {change} rows. Handles not
overflowing / underflowing the list.
@@ -2176,7 +2176,7 @@ action_set.edit({prompt_bufnr}, {command}) *action_set.edit()*
{command} (string) The command to use to open the file.
action_set.scroll_previewer({prompt_bufnr}, {direction})*action_set.scroll_previewer()*
action_set.scroll_previewer({prompt_bufnr}, {direction}) *action_set.scroll_previewer()*
Scrolls the previewer up or down
@@ -2255,7 +2255,7 @@ utils.map_selections({prompt_bufnr}, {f}) *utils.map_selections()*
that takes (selection) as a viable argument
utils.get_registered_mappings({prompt_bufnr})*utils.get_registered_mappings()*
utils.get_registered_mappings({prompt_bufnr}) *utils.get_registered_mappings()*
Utility to collect mappings of prompt buffer in array of `{mode, keybind,
name}`.
@@ -2571,7 +2571,7 @@ previewers.new_buffer_previewer() *previewers.new_buffer_previewer()*
previewers.buffer_previewer_maker({filepath}, {bufnr}, {opts})*previewers.buffer_previewer_maker()*
previewers.buffer_previewer_maker({filepath}, {bufnr}, {opts}) *previewers.buffer_previewer_maker()*
A universal way of reading a file into a buffer previewer. It handles async
reading, cache, highlighting, displaying directories and provides a
callback which can be used, to jump to a line in the buffer.
@@ -2627,7 +2627,7 @@ previewers.git_stash_diff() *previewers.git_stash_diff()*
previewers.git_commit_diff_to_parent()*previewers.git_commit_diff_to_parent()*
previewers.git_commit_diff_to_parent() *previewers.git_commit_diff_to_parent()*
A previewer that shows a diff of a commit to a parent commit.
The run command is `git --no-pager diff SHA^! -- $CURRENT_FILE`
@@ -2735,7 +2735,7 @@ histories.History:reset() *histories.History:reset()*
histories.History:append({line}, {picker}, {no_reset})*histories.History:append()*
histories.History:append({line}, {picker}, {no_reset}) *histories.History:append()*
Append a new line to the history