Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems displaying the intro screen in UI applications #24705

Open
fredizzimo opened this issue Aug 13, 2023 · 5 comments · May be fixed by #24764
Open

Problems displaying the intro screen in UI applications #24705

fredizzimo opened this issue Aug 13, 2023 · 5 comments · May be fixed by #24764
Labels
bug issues reporting wrong behavior gui ui ui-extensibility UI extensibility, events, protocol

Comments

@fredizzimo
Copy link
Contributor

Problem

We would like to display the intro screen in Neovide to for example make sure that the donation and sponsor links are displayed, and that we honor Bram's wishes. See neovide/neovide#620

But there are two problems, the intro screen is closed as soon as the window is redrawn. That is problematic because we don't know the final size at the time of nvim_ui_attach, the number of rows can change due to guifont and other settings that are applied during the startup.

One idea I had, is to add an auto command that runs at VimEnter and calls intro when there's only one buffer and it does not have any text. While I think that it works, I think it would be better if Neovim did that automatically.

The second problem is that it doesn't actually work with --multigrid. The text is displayed behind the main window and only "press ENTER or type command to continue" is visible. The message is displayed in grid 1, while grid 2 is on top, both with floating order None in Neovide we interpret this as the highest id is on top.

Steps to reproduce

  1. create a configuration that sets the guifont
  2. launch neovide --multigrid
  3. Observe that no intro screen is displayed
  4. run :intro
  5. Observe that the intro screen is rendered behind the buffer

Expected behavior

The intro screen should show.

Neovim version (nvim -v)

0.9.1

Vim (not Nvim) behaves the same?

N/A

Operating system/version

Arch Linux

Terminal name/version

Neovide

$TERM environment variable

alacritty

Installation

pacman

@fredizzimo fredizzimo added the bug issues reporting wrong behavior label Aug 13, 2023
@github-actions github-actions bot added the ui label Aug 13, 2023
@bfredl
Copy link
Member

bfredl commented Aug 13, 2023

The native implementation of the intro display logic in a bit ad-hoc and a bit tricky to integrate into the multigrid flow. what neovim core could do is to relay a semantic representation of the contents of the :intro message (as a list of the lines), which with the GUI:s cooperation could be displayed as the GUI sees fit.

@fredizzimo
Copy link
Contributor Author

Another option, which I think can be implemented completely by Neovide first, and then transferred to Neovim, would be to rewrite it in lua as a regular floating window. This could support external resizing, so that it's not closed when Neovide changes the size, but still closes on any other event like keyboard input or opening of a buffer.

I will experiment a bit with this soon. gettext seems to return the localizated text, which I think is all I need, other than converting the intro_message function to lua. But if implemented natively in Neovim, both versions should probably share the code.

@fredizzimo
Copy link
Contributor Author

I have now implemented, what I think is a working solution in Neovide in neovide/neovide#1980. And I think that something similar could be implemented in Neovim core. Maybe just the show_intro lua function.

I can work further on that and make a Neovim PR, if you think it's a good idea. Of course, the C code and Lua code would share the same functionality, unit tests added and the Neovim naming conventions and style used.

bfredl added a commit to bfredl/neovim that referenced this issue Aug 17, 2023
The intro message doesn't work very well with multigrid UI:s
The message is plainly drawn on the `default_grid` which is kinda ok
in TUI but doesn't provide any useful context for external UI:s.

Introduce a new `msg_intro` event with is used when `ext_multigrid`
and/or `ext_messages` is set.

Fixes neovim#24705
bfredl added a commit to bfredl/neovim that referenced this issue Aug 17, 2023
The intro message doesn't work very well with multigrid UI:s
The message is plainly drawn on the `default_grid` which is kinda ok
in TUI but doesn't provide any useful context for external UI:s.

Introduce a new `msg_intro` event with is used when `ext_multigrid`
and/or `ext_messages` is set.

Fixes neovim#24705
bfredl added a commit to bfredl/neovim that referenced this issue Aug 17, 2023
The intro message doesn't work very well with multigrid UI:s
The message is plainly drawn on the `default_grid` which is kinda ok
in TUI but doesn't provide any useful context for external UI:s.

Introduce a new `msg_intro` event with is used when `ext_multigrid`
and/or `ext_messages` is set.

Fixes neovim#24705
@bfredl
Copy link
Member

bfredl commented Aug 17, 2023

for nvim core, I think it would be better to forward the builtin message. Also has no duplicate strings which needs to be kept in sync. sketched here: #24764 .

bfredl added a commit to bfredl/neovim that referenced this issue Aug 17, 2023
The intro message doesn't work very well with multigrid UI:s
The message is plainly drawn on the `default_grid` which is kinda ok
in TUI but doesn't provide any useful context for external UI:s.

Introduce a new `msg_intro` event with is used when `ext_multigrid`
and/or `ext_messages` is set.

Fixes neovim#24705
@fredizzimo
Copy link
Contributor Author

@bfredl, thanks. I think your solution is workable. I would prefer if Neovim took care of the windowing completely though, but I understand that it's much more work.

On the Neovide side, I can use almost the same solution as I have there right now, just trigger it with by the UI event instead of the VimEnter autocommand, and as bonus it would trigger on :intro as well.

Maybe it would be good to include the triggering cause, startup or command. I think we would like to display it as a popup with borders and everything, with a message to press esc or q to close, like :lspinfo, when it's triggered manually. But keep the automatic closing when it's automatically shown at the startup.

I will test it a bit later, probably today or tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior gui ui ui-extensibility UI extensibility, events, protocol
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants