Karsten Hopp dd07b3
To: vim_dev@googlegroups.com
Karsten Hopp dd07b3
Subject: Patch 7.3.1288
Karsten Hopp dd07b3
Fcc: outbox
Karsten Hopp dd07b3
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp dd07b3
Mime-Version: 1.0
Karsten Hopp dd07b3
Content-Type: text/plain; charset=UTF-8
Karsten Hopp dd07b3
Content-Transfer-Encoding: 8bit
Karsten Hopp dd07b3
------------
Karsten Hopp dd07b3
Karsten Hopp dd07b3
Patch 7.3.1288
Karsten Hopp dd07b3
Problem:    The first ":echo 'hello'" command output doesn't show.  Mapping
Karsten Hopp dd07b3
	    for <S-F3> gets triggered during startup.
Karsten Hopp dd07b3
Solution:   Add debugging code for the termresponse.  When receiving the "Co"
Karsten Hopp dd07b3
	    entry and when setting 'ambiwidth' redraw right away if possible.
Karsten Hopp dd07b3
	    Add redraw_asap().  Don't set 'ambiwidth' if it already had the
Karsten Hopp dd07b3
	    right value.  Do the 'ambiwidth' check in the second row to avoid
Karsten Hopp dd07b3
	    confusion with <S-F3>.
Karsten Hopp dd07b3
Files:	    src/term.c, src/screen.c, src/proto/screen.pro
Karsten Hopp dd07b3
Karsten Hopp dd07b3
Karsten Hopp dd07b3
*** ../vim-7.3.1287/src/term.c	2013-07-01 20:06:13.000000000 +0200
Karsten Hopp dd07b3
--- src/term.c	2013-07-03 12:36:11.000000000 +0200
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 106,111 ****
Karsten Hopp dd07b3
--- 106,119 ----
Karsten Hopp dd07b3
  char		*tgetstr __ARGS((char *, char **));
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
  # ifdef FEAT_TERMRESPONSE
Karsten Hopp dd07b3
+     /* Change this to "if 1" to debug what happens with termresponse. */
Karsten Hopp dd07b3
+ #  if 0
Karsten Hopp dd07b3
+ #   define DEBUG_TERMRESPONSE
Karsten Hopp dd07b3
+     static void log_tr(char *msg);
Karsten Hopp dd07b3
+ #   define LOG_TR(msg) log_tr(msg)
Karsten Hopp dd07b3
+ #  else
Karsten Hopp dd07b3
+ #   define LOG_TR(msg)
Karsten Hopp dd07b3
+ #  endif
Karsten Hopp dd07b3
  /* Request Terminal Version status: */
Karsten Hopp dd07b3
  #  define CRV_GET	1	/* send T_CRV when switched to RAW mode */
Karsten Hopp dd07b3
  #  define CRV_SENT	2	/* did send T_CRV, waiting for answer */
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 1936,1941 ****
Karsten Hopp dd07b3
--- 1944,1950 ----
Karsten Hopp dd07b3
      full_screen = TRUE;		/* we can use termcap codes from now on */
Karsten Hopp dd07b3
      set_term_defaults();	/* use current values as defaults */
Karsten Hopp dd07b3
  #ifdef FEAT_TERMRESPONSE
Karsten Hopp dd07b3
+     LOG_TR("setting crv_status to CRV_GET");
Karsten Hopp dd07b3
      crv_status = CRV_GET;	/* Get terminal version later */
Karsten Hopp dd07b3
  #endif
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 3326,3331 ****
Karsten Hopp dd07b3
--- 3335,3341 ----
Karsten Hopp dd07b3
  # endif
Karsten Hopp dd07b3
  	    && *T_CRV != NUL)
Karsten Hopp dd07b3
      {
Karsten Hopp dd07b3
+ 	LOG_TR("Sending CRV");
Karsten Hopp dd07b3
  	out_str(T_CRV);
Karsten Hopp dd07b3
  	crv_status = CRV_SENT;
Karsten Hopp dd07b3
  	/* check for the characters now, otherwise they might be eaten by
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 3338,3347 ****
Karsten Hopp dd07b3
  # if defined(FEAT_MBYTE) || defined(PROTO)
Karsten Hopp dd07b3
  /*
Karsten Hopp dd07b3
   * Check how the terminal treats ambiguous character width (UAX #11).
Karsten Hopp dd07b3
!  * First, we move the cursor to (0, 0) and print a test ambiguous character
Karsten Hopp dd07b3
   * \u25bd (WHITE DOWN-POINTING TRIANGLE) and query current cursor position.
Karsten Hopp dd07b3
!  * If the terminal treats \u25bd as single width, the position is (0, 1),
Karsten Hopp dd07b3
!  * or if it is treated as double width, that will be (0, 2).
Karsten Hopp dd07b3
   * This function has the side effect that changes cursor position, so
Karsten Hopp dd07b3
   * it must be called immediately after entering termcap mode.
Karsten Hopp dd07b3
   */
Karsten Hopp dd07b3
--- 3348,3357 ----
Karsten Hopp dd07b3
  # if defined(FEAT_MBYTE) || defined(PROTO)
Karsten Hopp dd07b3
  /*
Karsten Hopp dd07b3
   * Check how the terminal treats ambiguous character width (UAX #11).
Karsten Hopp dd07b3
!  * First, we move the cursor to (1, 0) and print a test ambiguous character
Karsten Hopp dd07b3
   * \u25bd (WHITE DOWN-POINTING TRIANGLE) and query current cursor position.
Karsten Hopp dd07b3
!  * If the terminal treats \u25bd as single width, the position is (1, 1),
Karsten Hopp dd07b3
!  * or if it is treated as double width, that will be (1, 2).
Karsten Hopp dd07b3
   * This function has the side effect that changes cursor position, so
Karsten Hopp dd07b3
   * it must be called immediately after entering termcap mode.
Karsten Hopp dd07b3
   */
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 3361,3367 ****
Karsten Hopp dd07b3
      {
Karsten Hopp dd07b3
  	 char_u	buf[16];
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
! 	 term_windgoto(0, 0);
Karsten Hopp dd07b3
  	 buf[mb_char2bytes(0x25bd, buf)] = 0;
Karsten Hopp dd07b3
  	 out_str(buf);
Karsten Hopp dd07b3
  	 out_str(T_U7);
Karsten Hopp dd07b3
--- 3371,3380 ----
Karsten Hopp dd07b3
      {
Karsten Hopp dd07b3
  	 char_u	buf[16];
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
! 	 LOG_TR("Sending U7 request");
Karsten Hopp dd07b3
! 	 /* Do this in the second row.  In the first row the returned sequence
Karsten Hopp dd07b3
! 	  * may be CSI 1;2R, which is the same as <S-F3>. */
Karsten Hopp dd07b3
! 	 term_windgoto(1, 0);
Karsten Hopp dd07b3
  	 buf[mb_char2bytes(0x25bd, buf)] = 0;
Karsten Hopp dd07b3
  	 out_str(buf);
Karsten Hopp dd07b3
  	 out_str(T_U7);
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 3376,3381 ****
Karsten Hopp dd07b3
--- 3389,3417 ----
Karsten Hopp dd07b3
      }
Karsten Hopp dd07b3
  }
Karsten Hopp dd07b3
  # endif
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+ # ifdef DEBUG_TERMRESPONSE
Karsten Hopp dd07b3
+     static void
Karsten Hopp dd07b3
+ log_tr(char *msg)
Karsten Hopp dd07b3
+ {
Karsten Hopp dd07b3
+     static FILE *fd_tr = NULL;
Karsten Hopp dd07b3
+     static proftime_T start;
Karsten Hopp dd07b3
+     proftime_T now;
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+     if (fd_tr == NULL)
Karsten Hopp dd07b3
+     {
Karsten Hopp dd07b3
+ 	fd_tr = fopen("termresponse.log", "w");
Karsten Hopp dd07b3
+ 	profile_start(&start;;
Karsten Hopp dd07b3
+     }
Karsten Hopp dd07b3
+     now = start;
Karsten Hopp dd07b3
+     profile_end(&now;;
Karsten Hopp dd07b3
+     fprintf(fd_tr, "%s: %s %s\n",
Karsten Hopp dd07b3
+ 	    profile_msg(&now),
Karsten Hopp dd07b3
+ 	    must_redraw == NOT_VALID ? "NV"
Karsten Hopp dd07b3
+ 					 : must_redraw == CLEAR ? "CL" : "  ",
Karsten Hopp dd07b3
+ 	    msg);
Karsten Hopp dd07b3
+ }
Karsten Hopp dd07b3
+ # endif
Karsten Hopp dd07b3
  #endif
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
  /*
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 3847,3852 ****
Karsten Hopp dd07b3
--- 3883,3889 ----
Karsten Hopp dd07b3
  	need_gather = TRUE;		/* need to fill termleader[] */
Karsten Hopp dd07b3
      }
Karsten Hopp dd07b3
      detected_8bit = TRUE;
Karsten Hopp dd07b3
+     LOG_TR("Switching to 8 bit");
Karsten Hopp dd07b3
  }
Karsten Hopp dd07b3
  #endif
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 4156,4169 ****
Karsten Hopp dd07b3
  		    if (tp[i] == ';' && ++j == 1)
Karsten Hopp dd07b3
  			extra = i + 1;
Karsten Hopp dd07b3
  		if (i == len)
Karsten Hopp dd07b3
! 		    return -1;		/* not enough characters */
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
  #ifdef FEAT_MBYTE
Karsten Hopp dd07b3
! 		/* eat it when it has 2 arguments and ends in 'R' */
Karsten Hopp dd07b3
! 		if (j == 1 && tp[i] == 'R')
Karsten Hopp dd07b3
  		{
Karsten Hopp dd07b3
  		    char *aw = NULL;
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
  		    u7_status = U7_GOT;
Karsten Hopp dd07b3
  # ifdef FEAT_AUTOCMD
Karsten Hopp dd07b3
  		    did_cursorhold = TRUE;
Karsten Hopp dd07b3
--- 4193,4212 ----
Karsten Hopp dd07b3
  		    if (tp[i] == ';' && ++j == 1)
Karsten Hopp dd07b3
  			extra = i + 1;
Karsten Hopp dd07b3
  		if (i == len)
Karsten Hopp dd07b3
! 		{
Karsten Hopp dd07b3
! 		    LOG_TR("Not enough characters for CRV");
Karsten Hopp dd07b3
! 		    return -1;
Karsten Hopp dd07b3
! 		}
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
  #ifdef FEAT_MBYTE
Karsten Hopp dd07b3
! 		/* Eat it when it has 2 arguments and ends in 'R'. Ignore it
Karsten Hopp dd07b3
! 		 * when u7_status is not "sent", <S-F3> sends something
Karsten Hopp dd07b3
! 		 * similar. */
Karsten Hopp dd07b3
! 		if (j == 1 && tp[i] == 'R' && u7_status == U7_SENT)
Karsten Hopp dd07b3
  		{
Karsten Hopp dd07b3
  		    char *aw = NULL;
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
+ 		    LOG_TR("Received U7 status");
Karsten Hopp dd07b3
  		    u7_status = U7_GOT;
Karsten Hopp dd07b3
  # ifdef FEAT_AUTOCMD
Karsten Hopp dd07b3
  		    did_cursorhold = TRUE;
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 4174,4181 ****
Karsten Hopp dd07b3
  			aw = "single";
Karsten Hopp dd07b3
  		    else if (extra == 3)
Karsten Hopp dd07b3
  			aw = "double";
Karsten Hopp dd07b3
! 		    if (aw != NULL)
Karsten Hopp dd07b3
  			set_option_value((char_u *)"ambw", 0L, (char_u *)aw, 0);
Karsten Hopp dd07b3
  		    key_name[0] = (int)KS_EXTRA;
Karsten Hopp dd07b3
  		    key_name[1] = (int)KE_IGNORE;
Karsten Hopp dd07b3
  		    slen = i + 1;
Karsten Hopp dd07b3
--- 4217,4240 ----
Karsten Hopp dd07b3
  			aw = "single";
Karsten Hopp dd07b3
  		    else if (extra == 3)
Karsten Hopp dd07b3
  			aw = "double";
Karsten Hopp dd07b3
! 		    if (aw != NULL && STRCMP(aw, p_ambw) != 0)
Karsten Hopp dd07b3
! 		    {
Karsten Hopp dd07b3
! 			/* Setting the option causes a screen redraw. Do that
Karsten Hopp dd07b3
! 			 * right away if possible, keeping any messages. */
Karsten Hopp dd07b3
  			set_option_value((char_u *)"ambw", 0L, (char_u *)aw, 0);
Karsten Hopp dd07b3
+ #ifdef DEBUG_TERMRESPONSE
Karsten Hopp dd07b3
+ 			{
Karsten Hopp dd07b3
+ 			    char buf[100];
Karsten Hopp dd07b3
+ 			    int  r = redraw_asap(CLEAR);
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+ 			    sprintf(buf, "set 'ambiwidth', redraw_asap(): %d",
Karsten Hopp dd07b3
+ 									   r);
Karsten Hopp dd07b3
+ 			    log_tr(buf);
Karsten Hopp dd07b3
+ 			}
Karsten Hopp dd07b3
+ #else
Karsten Hopp dd07b3
+ 			redraw_asap(CLEAR);
Karsten Hopp dd07b3
+ #endif
Karsten Hopp dd07b3
+ 		    }
Karsten Hopp dd07b3
  		    key_name[0] = (int)KS_EXTRA;
Karsten Hopp dd07b3
  		    key_name[1] = (int)KE_IGNORE;
Karsten Hopp dd07b3
  		    slen = i + 1;
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 4185,4190 ****
Karsten Hopp dd07b3
--- 4244,4250 ----
Karsten Hopp dd07b3
  		/* eat it when at least one digit and ending in 'c' */
Karsten Hopp dd07b3
  		if (*T_CRV != NUL && i > 2 + (tp[0] != CSI) && tp[i] == 'c')
Karsten Hopp dd07b3
  		{
Karsten Hopp dd07b3
+ 		    LOG_TR("Received CRV");
Karsten Hopp dd07b3
  		    crv_status = CRV_GOT;
Karsten Hopp dd07b3
  # ifdef FEAT_AUTOCMD
Karsten Hopp dd07b3
  		    did_cursorhold = TRUE;
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 4224,4229 ****
Karsten Hopp dd07b3
--- 4284,4290 ----
Karsten Hopp dd07b3
  			/* if xterm version >= 141 try to get termcap codes */
Karsten Hopp dd07b3
  			if (extra >= 141)
Karsten Hopp dd07b3
  			{
Karsten Hopp dd07b3
+ 			    LOG_TR("Enable checking for XT codes");
Karsten Hopp dd07b3
  			    check_for_codes = TRUE;
Karsten Hopp dd07b3
  			    need_gather = TRUE;
Karsten Hopp dd07b3
  			    req_codes_from_term();
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 4262,4268 ****
Karsten Hopp dd07b3
--- 4323,4332 ----
Karsten Hopp dd07b3
  		    }
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
  		if (i == len)
Karsten Hopp dd07b3
+ 		{
Karsten Hopp dd07b3
+ 		    LOG_TR("not enough characters for XT");
Karsten Hopp dd07b3
  		    return -1;		/* not enough characters */
Karsten Hopp dd07b3
+ 		}
Karsten Hopp dd07b3
  	    }
Karsten Hopp dd07b3
  	}
Karsten Hopp dd07b3
  #endif
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 5207,5212 ****
Karsten Hopp dd07b3
--- 5271,5280 ----
Karsten Hopp dd07b3
  	return retval == 0 ? (len + extra + offset) : retval;
Karsten Hopp dd07b3
      }
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
+ #ifdef FEAT_TERMRESPONSE
Karsten Hopp dd07b3
+     LOG_TR("normal character");
Karsten Hopp dd07b3
+ #endif
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
      return 0;			    /* no match found */
Karsten Hopp dd07b3
  }
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 5661,5666 ****
Karsten Hopp dd07b3
--- 5729,5741 ----
Karsten Hopp dd07b3
       * many, there can be a buffer overflow somewhere. */
Karsten Hopp dd07b3
      while (xt_index_out < xt_index_in + 10 && key_names[xt_index_out] != NULL)
Karsten Hopp dd07b3
      {
Karsten Hopp dd07b3
+ # ifdef DEBUG_TERMRESPONSE
Karsten Hopp dd07b3
+ 	char dbuf[100];
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+ 	sprintf(dbuf, "Requesting XT %d: %s",
Karsten Hopp dd07b3
+ 				       xt_index_out, key_names[xt_index_out]);
Karsten Hopp dd07b3
+ 	log_tr(dbuf);
Karsten Hopp dd07b3
+ # endif
Karsten Hopp dd07b3
  	sprintf(buf, "\033P+q%02x%02x\033\\",
Karsten Hopp dd07b3
  		      key_names[xt_index_out][0], key_names[xt_index_out][1]);
Karsten Hopp dd07b3
  	out_str_nf((char_u *)buf);
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 5707,5712 ****
Karsten Hopp dd07b3
--- 5782,5795 ----
Karsten Hopp dd07b3
  		break;
Karsten Hopp dd07b3
  	    }
Karsten Hopp dd07b3
  	}
Karsten Hopp dd07b3
+ # ifdef DEBUG_TERMRESPONSE
Karsten Hopp dd07b3
+ 	{
Karsten Hopp dd07b3
+ 	    char buf[100];
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+ 	    sprintf(buf, "Received XT %d: %s", xt_index_in, (char *)name);
Karsten Hopp dd07b3
+ 	    log_tr(buf);
Karsten Hopp dd07b3
+ 	}
Karsten Hopp dd07b3
+ # endif
Karsten Hopp dd07b3
  	if (key_names[i] != NULL)
Karsten Hopp dd07b3
  	{
Karsten Hopp dd07b3
  	    for (i = 8; (c = hexhex2nr(code + i)) >= 0; i += 2)
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 5725,5731 ****
Karsten Hopp dd07b3
  		    set_keep_msg_from_hist();
Karsten Hopp dd07b3
  		    set_color_count(i);
Karsten Hopp dd07b3
  		    init_highlight(TRUE, FALSE);
Karsten Hopp dd07b3
! 		    redraw_later(CLEAR);
Karsten Hopp dd07b3
  		}
Karsten Hopp dd07b3
  	    }
Karsten Hopp dd07b3
  	    else
Karsten Hopp dd07b3
--- 5808,5824 ----
Karsten Hopp dd07b3
  		    set_keep_msg_from_hist();
Karsten Hopp dd07b3
  		    set_color_count(i);
Karsten Hopp dd07b3
  		    init_highlight(TRUE, FALSE);
Karsten Hopp dd07b3
! #ifdef DEBUG_TERMRESPONSE
Karsten Hopp dd07b3
! 		    {
Karsten Hopp dd07b3
! 			char buf[100];
Karsten Hopp dd07b3
! 			int  r = redraw_asap(CLEAR);
Karsten Hopp dd07b3
! 
Karsten Hopp dd07b3
! 			sprintf(buf, "Received t_Co, redraw_asap(): %d", r);
Karsten Hopp dd07b3
! 			log_tr(buf);
Karsten Hopp dd07b3
! 		    }
Karsten Hopp dd07b3
! #else
Karsten Hopp dd07b3
! 		    redraw_asap(CLEAR);
Karsten Hopp dd07b3
! #endif
Karsten Hopp dd07b3
  		}
Karsten Hopp dd07b3
  	    }
Karsten Hopp dd07b3
  	    else
Karsten Hopp dd07b3
*** ../vim-7.3.1287/src/screen.c	2013-07-01 20:18:26.000000000 +0200
Karsten Hopp dd07b3
--- src/screen.c	2013-07-03 12:45:14.000000000 +0200
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 268,273 ****
Karsten Hopp dd07b3
--- 268,414 ----
Karsten Hopp dd07b3
  }
Karsten Hopp dd07b3
  
Karsten Hopp dd07b3
  /*
Karsten Hopp dd07b3
+  * Redraw as soon as possible.  When the command line is not scrolled redraw
Karsten Hopp dd07b3
+  * right away and restore what was on the command line.
Karsten Hopp dd07b3
+  * Return a code indicating what happened.
Karsten Hopp dd07b3
+  */
Karsten Hopp dd07b3
+     int
Karsten Hopp dd07b3
+ redraw_asap(type)
Karsten Hopp dd07b3
+     int		type;
Karsten Hopp dd07b3
+ {
Karsten Hopp dd07b3
+     int		rows;
Karsten Hopp dd07b3
+     int		r;
Karsten Hopp dd07b3
+     int		ret = 0;
Karsten Hopp dd07b3
+     schar_T	*screenline;		/* copy from ScreenLines[] */
Karsten Hopp dd07b3
+     sattr_T	*screenattr;		/* copy from ScreenAttrs[] */
Karsten Hopp dd07b3
+ #ifdef FEAT_MBYTE
Karsten Hopp dd07b3
+     int		i;
Karsten Hopp dd07b3
+     u8char_T	*screenlineUC;		/* copy from ScreenLinesUC[] */
Karsten Hopp dd07b3
+     u8char_T	*screenlineC[MAX_MCO];	/* copy from ScreenLinesC[][] */
Karsten Hopp dd07b3
+     schar_T	*screenline2;		/* copy from ScreenLines2[] */
Karsten Hopp dd07b3
+ #endif
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+     redraw_later(type);
Karsten Hopp dd07b3
+     if (msg_scrolled || (State != NORMAL && State != NORMAL_BUSY))
Karsten Hopp dd07b3
+ 	return ret;
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+     /* Allocate space to save the text displayed in the command line area. */
Karsten Hopp dd07b3
+     rows = Rows - cmdline_row;
Karsten Hopp dd07b3
+     screenline = (schar_T *)lalloc(
Karsten Hopp dd07b3
+ 			   (long_u)(rows * Columns * sizeof(schar_T)), FALSE);
Karsten Hopp dd07b3
+     screenattr = (sattr_T *)lalloc(
Karsten Hopp dd07b3
+ 			   (long_u)(rows * Columns * sizeof(sattr_T)), FALSE);
Karsten Hopp dd07b3
+     if (screenline == NULL || screenattr == NULL)
Karsten Hopp dd07b3
+ 	ret = 2;
Karsten Hopp dd07b3
+ #ifdef FEAT_MBYTE
Karsten Hopp dd07b3
+     if (enc_utf8)
Karsten Hopp dd07b3
+     {
Karsten Hopp dd07b3
+ 	screenlineUC = (u8char_T *)lalloc(
Karsten Hopp dd07b3
+ 			  (long_u)(rows * Columns * sizeof(u8char_T)), FALSE);
Karsten Hopp dd07b3
+ 	if (screenlineUC == NULL)
Karsten Hopp dd07b3
+ 	    ret = 2;
Karsten Hopp dd07b3
+ 	for (i = 0; i < p_mco; ++i)
Karsten Hopp dd07b3
+ 	{
Karsten Hopp dd07b3
+ 	    screenlineC[i] = (u8char_T *)lalloc(
Karsten Hopp dd07b3
+ 			  (long_u)(rows * Columns * sizeof(u8char_T)), FALSE);
Karsten Hopp dd07b3
+ 	    if (screenlineC[i] == NULL)
Karsten Hopp dd07b3
+ 		ret = 2;
Karsten Hopp dd07b3
+ 	}
Karsten Hopp dd07b3
+     }
Karsten Hopp dd07b3
+     if (enc_dbcs == DBCS_JPNU)
Karsten Hopp dd07b3
+     {
Karsten Hopp dd07b3
+ 	screenline2 = (schar_T *)lalloc(
Karsten Hopp dd07b3
+ 			   (long_u)(rows * Columns * sizeof(schar_T)), FALSE);
Karsten Hopp dd07b3
+ 	if (screenline2 == NULL)
Karsten Hopp dd07b3
+ 	    ret = 2;
Karsten Hopp dd07b3
+     }
Karsten Hopp dd07b3
+ #endif
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+     if (ret != 2)
Karsten Hopp dd07b3
+     {
Karsten Hopp dd07b3
+ 	/* Save the text displayed in the command line area. */
Karsten Hopp dd07b3
+ 	for (r = 0; r < rows; ++r)
Karsten Hopp dd07b3
+ 	{
Karsten Hopp dd07b3
+ 	    mch_memmove(screenline + r * Columns,
Karsten Hopp dd07b3
+ 			ScreenLines + LineOffset[cmdline_row + r],
Karsten Hopp dd07b3
+ 			(size_t)Columns * sizeof(schar_T));
Karsten Hopp dd07b3
+ 	    mch_memmove(screenattr + r * Columns,
Karsten Hopp dd07b3
+ 			ScreenAttrs + LineOffset[cmdline_row + r],
Karsten Hopp dd07b3
+ 			(size_t)Columns * sizeof(sattr_T));
Karsten Hopp dd07b3
+ #ifdef FEAT_MBYTE
Karsten Hopp dd07b3
+ 	    if (enc_utf8)
Karsten Hopp dd07b3
+ 	    {
Karsten Hopp dd07b3
+ 		mch_memmove(screenlineUC + r * Columns,
Karsten Hopp dd07b3
+ 			    ScreenLinesUC + LineOffset[cmdline_row + r],
Karsten Hopp dd07b3
+ 			    (size_t)Columns * sizeof(u8char_T));
Karsten Hopp dd07b3
+ 		for (i = 0; i < p_mco; ++i)
Karsten Hopp dd07b3
+ 		    mch_memmove(screenlineC[i] + r * Columns,
Karsten Hopp dd07b3
+ 				ScreenLinesC[r] + LineOffset[cmdline_row + r],
Karsten Hopp dd07b3
+ 				(size_t)Columns * sizeof(u8char_T));
Karsten Hopp dd07b3
+ 	    }
Karsten Hopp dd07b3
+ 	    if (enc_dbcs == DBCS_JPNU)
Karsten Hopp dd07b3
+ 		mch_memmove(screenline2 + r * Columns,
Karsten Hopp dd07b3
+ 			    ScreenLines2 + LineOffset[cmdline_row + r],
Karsten Hopp dd07b3
+ 			    (size_t)Columns * sizeof(schar_T));
Karsten Hopp dd07b3
+ #endif
Karsten Hopp dd07b3
+ 	}
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+ 	update_screen(0);
Karsten Hopp dd07b3
+ 	ret = 3;
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+ 	if (must_redraw == 0)
Karsten Hopp dd07b3
+ 	{
Karsten Hopp dd07b3
+ 	    int	off = (int)(current_ScreenLine - ScreenLines);
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+ 	    /* Restore the text displayed in the command line area. */
Karsten Hopp dd07b3
+ 	    for (r = 0; r < rows; ++r)
Karsten Hopp dd07b3
+ 	    {
Karsten Hopp dd07b3
+ 		mch_memmove(current_ScreenLine,
Karsten Hopp dd07b3
+ 			    screenline + r * Columns,
Karsten Hopp dd07b3
+ 			    (size_t)Columns * sizeof(schar_T));
Karsten Hopp dd07b3
+ 		mch_memmove(ScreenAttrs + off,
Karsten Hopp dd07b3
+ 			    screenattr + r * Columns,
Karsten Hopp dd07b3
+ 			    (size_t)Columns * sizeof(sattr_T));
Karsten Hopp dd07b3
+ #ifdef FEAT_MBYTE
Karsten Hopp dd07b3
+ 		if (enc_utf8)
Karsten Hopp dd07b3
+ 		{
Karsten Hopp dd07b3
+ 		    mch_memmove(ScreenLinesUC + off,
Karsten Hopp dd07b3
+ 				screenlineUC + r * Columns,
Karsten Hopp dd07b3
+ 				(size_t)Columns * sizeof(u8char_T));
Karsten Hopp dd07b3
+ 		    for (i = 0; i < p_mco; ++i)
Karsten Hopp dd07b3
+ 			mch_memmove(ScreenLinesC[i] + off,
Karsten Hopp dd07b3
+ 				    screenlineC[i] + r * Columns,
Karsten Hopp dd07b3
+ 				    (size_t)Columns * sizeof(u8char_T));
Karsten Hopp dd07b3
+ 		}
Karsten Hopp dd07b3
+ 		if (enc_dbcs == DBCS_JPNU)
Karsten Hopp dd07b3
+ 		    mch_memmove(ScreenLines2 + off,
Karsten Hopp dd07b3
+ 				screenline2 + r * Columns,
Karsten Hopp dd07b3
+ 				(size_t)Columns * sizeof(schar_T));
Karsten Hopp dd07b3
+ #endif
Karsten Hopp dd07b3
+ 		SCREEN_LINE(cmdline_row + r, 0, Columns, Columns, FALSE);
Karsten Hopp dd07b3
+ 	    }
Karsten Hopp dd07b3
+ 	    ret = 4;
Karsten Hopp dd07b3
+ 	}
Karsten Hopp dd07b3
+ 	setcursor();
Karsten Hopp dd07b3
+     }
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+     vim_free(screenline);
Karsten Hopp dd07b3
+     vim_free(screenattr);
Karsten Hopp dd07b3
+ #ifdef FEAT_MBYTE
Karsten Hopp dd07b3
+     if (enc_utf8)
Karsten Hopp dd07b3
+     {
Karsten Hopp dd07b3
+ 	vim_free(screenlineUC);
Karsten Hopp dd07b3
+ 	for (i = 0; i < p_mco; ++i)
Karsten Hopp dd07b3
+ 	    vim_free(screenlineC[i]);
Karsten Hopp dd07b3
+     }
Karsten Hopp dd07b3
+     if (enc_dbcs == DBCS_JPNU)
Karsten Hopp dd07b3
+ 	vim_free(screenline2);
Karsten Hopp dd07b3
+ #endif
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+     return ret;
Karsten Hopp dd07b3
+ }
Karsten Hopp dd07b3
+ 
Karsten Hopp dd07b3
+ /*
Karsten Hopp dd07b3
   * Changed something in the current window, at buffer line "lnum", that
Karsten Hopp dd07b3
   * requires that line and possibly other lines to be redrawn.
Karsten Hopp dd07b3
   * Used when entering/leaving Insert mode with the cursor on a folded line.
Karsten Hopp dd07b3
*** ../vim-7.3.1287/src/proto/screen.pro	2012-12-05 16:10:21.000000000 +0100
Karsten Hopp dd07b3
--- src/proto/screen.pro	2013-07-02 22:18:00.000000000 +0200
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 5,10 ****
Karsten Hopp dd07b3
--- 5,11 ----
Karsten Hopp dd07b3
  void redraw_all_later __ARGS((int type));
Karsten Hopp dd07b3
  void redraw_curbuf_later __ARGS((int type));
Karsten Hopp dd07b3
  void redraw_buf_later __ARGS((buf_T *buf, int type));
Karsten Hopp dd07b3
+ int redraw_asap __ARGS((int type));
Karsten Hopp dd07b3
  void redrawWinline __ARGS((linenr_T lnum, int invalid));
Karsten Hopp dd07b3
  void update_curbuf __ARGS((int type));
Karsten Hopp dd07b3
  void update_screen __ARGS((int type));
Karsten Hopp dd07b3
*** ../vim-7.3.1287/src/version.c	2013-07-01 22:02:58.000000000 +0200
Karsten Hopp dd07b3
--- src/version.c	2013-07-02 23:10:57.000000000 +0200
Karsten Hopp dd07b3
***************
Karsten Hopp dd07b3
*** 730,731 ****
Karsten Hopp dd07b3
--- 730,733 ----
Karsten Hopp dd07b3
  {   /* Add new patch number below this line */
Karsten Hopp dd07b3
+ /**/
Karsten Hopp dd07b3
+     1288,
Karsten Hopp dd07b3
  /**/
Karsten Hopp dd07b3
Karsten Hopp dd07b3
-- 
Karsten Hopp dd07b3
Yesterday is history.
Karsten Hopp dd07b3
Tomorrow is a mystery.
Karsten Hopp dd07b3
Today is a gift.
Karsten Hopp dd07b3
That's why it is called 'present'.
Karsten Hopp dd07b3
Karsten Hopp dd07b3
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp dd07b3
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp dd07b3
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp dd07b3
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///