Subject: Re: patch 5.4.7
From: Bram Moolenaar <[email-masked]>
To: Will Day <[email-masked]>
Cc: VIM Development Mailing List <[email-masked]>

------------

Will Day wrote:

> >I think you misunderstood this (or I didn't understand you).  What this
> >patch solves is typing 'q' at the more prompt.  Not typing 'q' at the
> >following dialog.
> 
> Right, it's supposed to solve hitting a q at the more prompt, but the more
> prompt isn't actually being produced until the call to do_dialog; it's
> produced by msg_moremsg called by display_confirm_msg called by
> msg_show_console_dialog called by do_dialog.  So, clearing got_int before
> calling do_dialog doesn't solve the problem.

Aha, you get another more prompt.  Hmm, this requires a terminal of exactly 25
lines.  Anyway, you are right, this can happen.  Sorry I didn't get this the
first time.

> Actually, from what I can tell, it wasn't that the q at the more prompt was
> being interpreted as hitting q at the dialog, but that hitting q at the
> more prompt set got_int=3D1, and even if you went on to hit (e)dit anyway at
> the dialog prompt, it would abort the load because of got_int.

Correct.

> The behavior I would expect, based on using more prompts over the years,
> would be to hit 'q' at the more prompt, and then have the dialog prompt
> appear (whereas above, it does not appear), and thus any intervening text
> is skipped.  I think part of the problem in this case is that there _is_ no
> intervening text, and it's the text of the dialog prompt itself which is
> causing vim to think it needs a more prompt.

Right.  This is hard to avoid, since skipping the more prompt would mean that
you actually will miss the first line of the ATTENTION message, which is going
to scroll off-screen.  But the dialog prompt should appear, since we wait for
the user to enter a key.

Hmm, this is a bit tricky, since aborting the message when 'q' is hit is at
quite a low level.  The simplest solution that I see is to disable the effect
of quitting at the more prompt for the dialog message.  I don't see a reason
why one would want to quit for such a short message.  And the dialog itself
allows quitting with CTRL-C or <Esc>.

OK, I have made a patch for it.  Hopefully it's all really fixed now!

Patch 5.4.19
Problem:    In a terminal with 25 lines, there is a more prompt after the
            ATTENTION message.  When hitting 'q' here the dialog prompt
            doesn't appear and file loading is interrupted. (Will Day)
Solution:   Don't allow quitting the printing of a message for the dialog
            prompt.  Added the msg_noquit_more flag for this.
Files:      src/message.c

*** ../vim-5.4/src/message.c	Sun Jul 25 22:02:19 1999
--- src/message.c	Mon Aug  9 23:41:38 1999
***************
*** 28,33 ****
--- 28,34 ----
  static void redir_write __ARGS((char_u *s));
  #ifdef CON_DIALOG
  static char_u *msg_show_console_dialog __ARGS((char_u *message, char_u *buttons, int dfltbutton));
+ static int msg_noquit_more = FALSE; /* quit not allowed at more prompt */
  #endif
  
  struct msg_hist
***************
*** 1273,1280 ****
  		    case 'q':		/* quit */
  		    case Ctrl('C'):
  		    case ESC:
! 			got_int = TRUE;
! 			quit_more = TRUE;
  			break;
  		    case 'u':		/* Up half a page */
  		    case K_PAGEUP:
--- 1274,1292 ----
  		    case 'q':		/* quit */
  		    case Ctrl('C'):
  		    case ESC:
! #ifdef CON_DIALOG
! 			if (msg_noquit_more)
! 			{
! 			    /* When quitting is not possible, behave like
! 			     * another page can be printed */
! 			    lines_left = Rows - 1;
! 			}
! 			else
! #endif
! 			{
! 			    got_int = TRUE;
! 			    quit_more = TRUE;
! 			}
  			break;
  		    case 'u':		/* Up half a page */
  		    case K_PAGEUP:
***************
*** 1841,1848 ****
--- 1853,1863 ----
      void
  display_confirm_msg()
  {
+     /* avoid that 'q' at the more prompt truncates the message here */
+     ++msg_noquit_more;
      if (confirm_msg != NULL)
  	msg_puts_attr(confirm_msg, hl_attr(HLF_M));
+     --msg_noquit_more;
  }
  
  #endif /* CON_DIALOG */
*** ../vim-5.4/src/version.h	Mon Aug  9 11:37:30 1999
--- src/version.h	Mon Aug  9 23:43:19 1999
***************
*** 19,26 ****
  #define VIM_VERSION_MINOR_STR		"4"
  #define VIM_VERSION_BUILD		 57
  #define VIM_VERSION_BUILD_STR		"57"
! #define VIM_VERSION_PATCHLEVEL		 18
! #define VIM_VERSION_PATCHLEVEL_STR	"18"
  
  /*
   * VIM_VERSION_NODOT is used for the runtime directory name.
--- 19,26 ----
  #define VIM_VERSION_MINOR_STR		"4"
  #define VIM_VERSION_BUILD		 57
  #define VIM_VERSION_BUILD_STR		"57"
! #define VIM_VERSION_PATCHLEVEL		 19
! #define VIM_VERSION_PATCHLEVEL_STR	"19"
  
  /*
   * VIM_VERSION_NODOT is used for the runtime directory name.
***************
*** 30,35 ****
   */
  #define VIM_VERSION_NODOT	"vim54"
  #define VIM_VERSION_SHORT	"5.4"
! #define VIM_VERSION_MEDIUM	"5.4.18"
! #define VIM_VERSION_LONG	"VIM - Vi IMproved 5.4.18 (1999 Aug 9)"
! #define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 5.4.18 (1999 Aug 9, compiled "
--- 30,35 ----
   */
  #define VIM_VERSION_NODOT	"vim54"
  #define VIM_VERSION_SHORT	"5.4"
! #define VIM_VERSION_MEDIUM	"5.4.19"
! #define VIM_VERSION_LONG	"VIM - Vi IMproved 5.4.19 (1999 Aug 9)"
! #define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 5.4.19 (1999 Aug 9, compiled "

--
hundred-and-one symptoms of being an internet addict:
12. You turn off your modem and get this awful empty feeling, like you just
    pulled the plug on a loved one.

--/-/---- Bram Moolenaar ---- [email-masked] ---- [email-masked] ---\-\--
  \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /