Re: [vim/vim] 'set showcmd' messes up mappings when the {rhs} is longer than the screen width (#2268)

2017-11-02 Fir de Conversatie Christian Brabandt

On Do, 02 Nov 2017, Tony Mechelynck wrote:

> On Thu, Nov 2, 2017 at 9:54 AM, Christian Brabandt
>  wrote:
> > Okay, could finally reproduce it. This is really a subtle bug popping up.
> > This happens, because when executing your function, the command will be put
> > on the commandline, which causes a scroll. Vim then get's into the hit-enter
> > prompt and expects a character from the user. Now by coincidence the next
> > character in the typebuf is g which is a character that is accepted by the
> > hit-enter prompt and thus that character will be consumed and not available
> > for the normal mode command gv anymore.
> >
> > I think using the  flag should work around it, I think.
> >
> > Here is a patch, that basically skips putting the character on the
> > commandline, if they come from a mapping. I think we do not need to put the
> > characters to be executed on the commandline if they come from a mapping
> > (which should also save a redraw).
> 
> Isn't ":silent" enough? Or maybe a slight increase in 'cmdheight'? I
> have several mappings which execute short ex-commands, and I _like_
> seeing them echoed on the command-line.

That does not solve the problem that the mapping will do different 
things depending on the screen-width and is not portable/reproducible 
anymore.

Perhaps this patch is better:

diff --git a/src/message.c b/src/message.c
index 221e3d801..62c9f8f5a 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1055,7 +1055,7 @@ wait_return(int redraw)

 redir_off = TRUE;  /* don't redirect this message */
 oldState = State;
-if (quit_more)
+if (quit_more || !typebuf_typed())
 {
c = CAR;/* just pretend CR was hit */
quit_more = FALSE;


Christian
-- 
Letzte Worte eines Co-Piloten:
  "Was meinst Du mit: 'Ich hab vergessen zu tanken.'"

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [vim/vim] 'set showcmd' messes up mappings when the {rhs} is longer than the screen width (#2268)

2017-11-02 Fir de Conversatie Tony Mechelynck
On Thu, Nov 2, 2017 at 9:54 AM, Christian Brabandt
 wrote:
> Okay, could finally reproduce it. This is really a subtle bug popping up.
> This happens, because when executing your function, the command will be put
> on the commandline, which causes a scroll. Vim then get's into the hit-enter
> prompt and expects a character from the user. Now by coincidence the next
> character in the typebuf is g which is a character that is accepted by the
> hit-enter prompt and thus that character will be consumed and not available
> for the normal mode command gv anymore.
>
> I think using the  flag should work around it, I think.
>
> Here is a patch, that basically skips putting the character on the
> commandline, if they come from a mapping. I think we do not need to put the
> characters to be executed on the commandline if they come from a mapping
> (which should also save a redraw).

Isn't ":silent" enough? Or maybe a slight increase in 'cmdheight'? I
have several mappings which execute short ex-commands, and I _like_
seeing them echoed on the command-line.

Best regards,
Tony.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.