Change center layout strategy to allow vertical anchoring (#1719)

* Change center layout strategy to allow vertical anchoring

Affects `telescope.pickers.layout_strategies.center` that is used by dropdown
(`telescope.themes.get_dropdown()`) theme, allowing more customization for
dropdown theme, i. e. setting it in the top with mirrored preview.

For `anchor` containing `N` or `S` will ignore `mirror` config
and preview will be placed as follows:
- Anchoring for `N` put the preview below the prompt result block.
- Anchoring for `S` put the preview above the prompt result block.

- For horizontal anchoring preview will be placed according to `mirror`.

* [docgen] Update doc/telescope.txt
skip-checks: true

Co-authored-by: Github Actions <actions@github>
This commit is contained in:
Alef Pereira
2022-03-02 18:05:09 -04:00
committed by GitHub
parent 567ec85b15
commit 76120285f8
2 changed files with 43 additions and 19 deletions

View File

@@ -1631,11 +1631,15 @@ layout_strategies.horizontal() *layout_strategies.horizontal()*
layout_strategies.center() *layout_strategies.center()*
Centered layout with a combined block of the prompt and results aligned to
the middle of the screen. The preview window is then placed in the
remaining space above. Particularly useful for creating dropdown menus (see
|telescope.themes| and |themes.get_dropdown()|`).
remaining space above or below, according to `anchor` or `mirror`.
Particularly useful for creating dropdown menus (see |telescope.themes| and
|themes.get_dropdown()|).
Note that the `anchor` option can only pin this layout to the left or right
edges.
Note that vertical anchoring, i.e. `anchor` containing `"N"` or `"S"`, will
override `mirror` config. For `"N"` anchoring preview will be placed below
prompt/result block. For `"S"` anchoring preview will be placed above
prompt/result block. For horizontal only anchoring preview will be placed
according to `mirror` config, default is above the prompt/result block.
┌──────────────────────────────────────────────────┐
│ ┌────────────────────────────────────────┐ │