You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helix-plus/helix-term/src/ui
Michael Davis 39f7ba36e0
ignore Enter keypress when menu has no selection (#1704)
* ignore Enter keypress when menu has no selection

supersedes #1622

Builds on the work in #1285. I want to allow Enter to create a newline
when there is no selection in the autocomplete menu.

This occurs somewhat often when using LSP autocomplete in Elixir which
uses `do/end` blocks (and I set the autocomplete menu delay to 0 which
exacerbates the problem):

```elixir
defmodule MyModule do
  def do_foo(x) do
    x
  end
  def other_function(y) do|
end
```

Here the cursor is `|` in insert mode. The LSP suggests `do_foo` but I
want to create a newline. Hitting Enter currently closes the menu,
so I end up having to hit Enter twice when the module contains any
local with a `do` prefix, which can be inconsistent. With this change,
we ignore the Enter keypress to end up creating the newline in this case.

* pop compositor layer when ignoring Enter keypress

* move closing function out of consumed event result closure

* explicitly label close_fn as an 'Option<Callback>'
2 years ago
..
completion.rs Fix 1.60 lints 2 years ago
editor.rs Close some popups automatically (#1285) 2 years ago
info.rs info component style config use ui.info ui.info.text (#643) 3 years ago
markdown.rs fix: ui: Markdown popups stopped taking vertical padding into account 2 years ago
menu.rs ignore Enter keypress when menu has no selection (#1704) 2 years ago
mod.rs Always ignore the .git directory in file picker (#1604) 2 years ago
overlay.rs Add `PageUp`, `PageDown`, `Ctrl-u`, `Ctrl-d`, `Home`, `End` keyboard shortcuts to file picker (#1612) 2 years ago
picker.rs Close some popups automatically (#1285) 2 years ago
popup.rs Close some popups automatically (#1285) 2 years ago
prompt.rs Close some popups automatically (#1285) 2 years ago
spinner.rs Instant is more suitable than SystemTime for spinners 2 years ago
text.rs fix: Allow multi-line prompt documentation 2 years ago