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

fix: fix #301 #305

Merged
merged 1 commit into from
Sep 3, 2022
Merged

fix: fix #301 #305

merged 1 commit into from
Sep 3, 2022

Conversation

xiyaowong
Copy link
Contributor

No description provided.

@registerGen
Copy link

registerGen commented Jul 3, 2022

Just curious, what’s this echo used for?

@jemag
Copy link

jemag commented Jul 3, 2022

Tested around a bit and works fine for me without vim.cmd [[echon ""]]

Is there a reason to keep that dummy output?

@Shougo
Copy link

Shougo commented Jul 3, 2022

I think it is used for clear current command line. It is not needed for cmdheight=0 though.

@xiyaowong
Copy link
Contributor Author

I think it is used for clear current command line. It is not needed for cmdheight=0 though.

echon works well no matter what the value of cmdheight is, I don't think it's necessary to add a check for cmdheight, just keep it simple

@xiyaowong
Copy link
Contributor Author

@registerGen @jemag It's used to clear the input context

vim.api.nvim_echo(cmd_line, false, {})

@xiyaowong
Copy link
Contributor Author

xiyaowong commented Jul 3, 2022

image
this also works

@Shougo echo will definitely cause waiting for enter, is it expected?

@Shougo
Copy link

Shougo commented Jul 3, 2022

@Shougo echo will definitely cause waiting for enter, is it expected?

It is expected. Because you have not command line area.
Please see cmdheight description.

						*'cmdheight'* *'ch'*
'cmdheight' 'ch'	number	(default 1)
			global
	Number of screen lines to use for the command-line.  Helps avoiding
	|hit-enter| prompts.
	The value of this option is stored with the tab page, so that each tab
	page can have a different value.

	When 'cmdheight' is zero, it disables echo area and all outputs need
	|hit-enter| prompt.

@xiyaowong
Copy link
Contributor Author

@Shougo Oh, I forgot to read the help about cmdheight, thanks for the tip

@bennypowers
Copy link

This also affects gq

For those affected, if you prefer not to install the fork branch, you can dynamically patch which-key while we wait for review and merge:

put this somewhere in your config, I put it in the bottom of the file which calls wk.setup

---PATCH from https://github.com/folke/which-key.nvim/pull/305
local wk_view = require 'which-key.view'
wk_view.hide = function()
  vim.api.nvim_echo({ { "" } }, false, {})
  vim.cmd 'redraw'
  wk_view.hide_cursor()
  if wk_view.buf and vim.api.nvim_buf_is_valid(wk_view.buf) then
    vim.api.nvim_buf_delete(wk_view.buf, { force = true })
    wk_view.buf = nil
  end
  if wk_view.win and vim.api.nvim_win_is_valid(wk_view.win) then
    vim.api.nvim_win_close(wk_view.win, { force = true })
    wk_view.win = nil
  end
end
---ENDPATCH

xaviervalarino added a commit to xaviervalarino/dotfiles that referenced this pull request Aug 31, 2022
xaviervalarino added a commit to xaviervalarino/dotfiles that referenced this pull request Aug 31, 2022
@folke folke merged commit 9cd09ca into folke:main Sep 3, 2022
registerGen added a commit to registerGen/dotfiles that referenced this pull request Sep 3, 2022
njhoffman pushed a commit to njhoffman/which-key.nvim that referenced this pull request Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants