helix/helix-term/src
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>'
2022-02-27 16:20:21 +09:00
..
commands Alert if LSP is inactive when command is invoked (#1703) 2022-02-25 17:53:10 +09:00
ui ignore Enter keypress when menu has no selection (#1704) 2022-02-27 16:20:21 +09:00
application.rs Use which to resolve lsp/dap binaries 2022-02-24 11:38:40 +09:00
args.rs Fix bug when launching hx file.rs:10 (#1676) 2022-02-18 12:13:02 +09:00
commands.rs fix(commands): don't indent empty lines (#1653) 2022-02-25 17:49:02 +09:00
compositor.rs Close some popups automatically (#1285) 2022-02-23 12:46:12 +09:00
config.rs Put some tests behind #[cfg(test)] (#1459) 2022-01-09 00:32:50 +09:00
job.rs Don't use block_on in jobs.finish(), we can .await 2022-02-05 15:05:19 +09:00
keymap.rs feat(commands): command palette (#1400) 2022-02-17 14:03:11 +09:00
lib.rs Assume true color support on Windows 2021-12-14 00:48:45 +09:00
main.rs Allow specifying file start position (#445) 2022-01-23 16:54:03 +09:00