Bottom up mode for custom menu (#848)

* Try to fix col adjustment (#843)

* Try to fix col adjuastment

* Improve duplicated text handling

* Bottom up mode for custom entry menu

When in command line mode, the custom entry window opens up to an
unexpected height, depending on the current count of completion items.
The above makes it hard to anticipate where to look at, and makes life a bit
harder.

This patch adds an option to open the custom entries view in a bottom up
mode, and flips the regular behaviour of next/prev entry in this mode.
Setup is as easy as:

```
cmp.setup.cmdline(':', {
  view = {
    entries = {name = 'custom', direction = 'bottom_up' }
  }
}
```

* fix stylua complaints

* sylua barfs

* solve some corner cases

* properly reverse entries table

* make custom view follow cursor

* respect default as top_down

* stylua

* more stylua

Co-authored-by: hrsh7th <hrsh7th@gmail.com>
This commit is contained in:
tzachar
2022-04-08 16:33:09 +03:00
committed by GitHub
parent 7903e867b6
commit 1558d110d7
4 changed files with 70 additions and 16 deletions

View File

@@ -144,6 +144,7 @@ cmp.ItemField.Menu = 'menu'
---@class cmp.CustomEntriesConfig
---@field name "'custom'"
---@field selection_order "'top_down'"|"'near_cursor'"
---@class cmp.NativeEntriesConfig
---@field name "'native'"