Karsten Hopp d706e6
To: vim_dev@googlegroups.com
Karsten Hopp d706e6
Subject: Patch 7.4.143
Karsten Hopp d706e6
Fcc: outbox
Karsten Hopp d706e6
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp d706e6
Mime-Version: 1.0
Karsten Hopp d706e6
Content-Type: text/plain; charset=UTF-8
Karsten Hopp d706e6
Content-Transfer-Encoding: 8bit
Karsten Hopp d706e6
------------
Karsten Hopp d706e6
Karsten Hopp d706e6
Patch 7.4.143
Karsten Hopp d706e6
Problem:    TextChangedI is not triggered.
Karsten Hopp d706e6
Solution:   Reverse check for "ready". (lilydjwg)
Karsten Hopp d706e6
Files:	    src/edit.c
Karsten Hopp d706e6
Karsten Hopp d706e6
Karsten Hopp d706e6
*** ../vim-7.4.142/src/edit.c	2013-11-06 04:01:31.000000000 +0100
Karsten Hopp d706e6
--- src/edit.c	2014-01-12 13:30:53.000000000 +0100
Karsten Hopp d706e6
***************
Karsten Hopp d706e6
*** 1556,1642 ****
Karsten Hopp d706e6
      int		conceal_update_lines = FALSE;
Karsten Hopp d706e6
  #endif
Karsten Hopp d706e6
  
Karsten Hopp d706e6
!     if (!char_avail())
Karsten Hopp d706e6
!     {
Karsten Hopp d706e6
  #if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
Karsten Hopp d706e6
! 	/* Trigger CursorMoved if the cursor moved.  Not when the popup menu is
Karsten Hopp d706e6
! 	 * visible, the command might delete it. */
Karsten Hopp d706e6
! 	if (ready && (
Karsten Hopp d706e6
  # ifdef FEAT_AUTOCMD
Karsten Hopp d706e6
! 		    has_cursormovedI()
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
  # if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL)
Karsten Hopp d706e6
! 		    ||
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
  # ifdef FEAT_CONCEAL
Karsten Hopp d706e6
! 		    curwin->w_p_cole > 0
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
! 		    )
Karsten Hopp d706e6
! 	    && !equalpos(last_cursormoved, curwin->w_cursor)
Karsten Hopp d706e6
  # ifdef FEAT_INS_EXPAND
Karsten Hopp d706e6
! 	    && !pum_visible()
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
! 	   )
Karsten Hopp d706e6
! 	{
Karsten Hopp d706e6
  # ifdef FEAT_SYN_HL
Karsten Hopp d706e6
! 	    /* Need to update the screen first, to make sure syntax
Karsten Hopp d706e6
! 	     * highlighting is correct after making a change (e.g., inserting
Karsten Hopp d706e6
! 	     * a "(".  The autocommand may also require a redraw, so it's done
Karsten Hopp d706e6
! 	     * again below, unfortunately. */
Karsten Hopp d706e6
! 	    if (syntax_present(curwin) && must_redraw)
Karsten Hopp d706e6
! 		update_screen(0);
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
  # ifdef FEAT_AUTOCMD
Karsten Hopp d706e6
! 	    if (has_cursormovedI())
Karsten Hopp d706e6
! 		apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf);
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
  # ifdef FEAT_CONCEAL
Karsten Hopp d706e6
! 	    if (curwin->w_p_cole > 0)
Karsten Hopp d706e6
! 	    {
Karsten Hopp d706e6
! 		conceal_old_cursor_line = last_cursormoved.lnum;
Karsten Hopp d706e6
! 		conceal_new_cursor_line = curwin->w_cursor.lnum;
Karsten Hopp d706e6
! 		conceal_update_lines = TRUE;
Karsten Hopp d706e6
! 	    }
Karsten Hopp d706e6
! # endif
Karsten Hopp d706e6
! 	    last_cursormoved = curwin->w_cursor;
Karsten Hopp d706e6
  	}
Karsten Hopp d706e6
  #endif
Karsten Hopp d706e6
  #ifdef FEAT_AUTOCMD
Karsten Hopp d706e6
! 	/* Trigger TextChangedI if b_changedtick differs. */
Karsten Hopp d706e6
! 	if (!ready && has_textchangedI()
Karsten Hopp d706e6
! 		&& last_changedtick != curbuf->b_changedtick
Karsten Hopp d706e6
  # ifdef FEAT_INS_EXPAND
Karsten Hopp d706e6
! 		&& !pum_visible()
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
! 		)
Karsten Hopp d706e6
! 	{
Karsten Hopp d706e6
! 	    if (last_changedtick_buf == curbuf)
Karsten Hopp d706e6
! 		apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
Karsten Hopp d706e6
! 	    last_changedtick_buf = curbuf;
Karsten Hopp d706e6
! 	    last_changedtick = curbuf->b_changedtick;
Karsten Hopp d706e6
! 	}
Karsten Hopp d706e6
  #endif
Karsten Hopp d706e6
! 	if (must_redraw)
Karsten Hopp d706e6
! 	    update_screen(0);
Karsten Hopp d706e6
! 	else if (clear_cmdline || redraw_cmdline)
Karsten Hopp d706e6
! 	    showmode();		/* clear cmdline and show mode */
Karsten Hopp d706e6
  # if defined(FEAT_CONCEAL)
Karsten Hopp d706e6
! 	if ((conceal_update_lines
Karsten Hopp d706e6
! 		&& (conceal_old_cursor_line != conceal_new_cursor_line
Karsten Hopp d706e6
! 		    || conceal_cursor_line(curwin)))
Karsten Hopp d706e6
! 		|| need_cursor_line_redraw)
Karsten Hopp d706e6
! 	{
Karsten Hopp d706e6
! 	    if (conceal_old_cursor_line != conceal_new_cursor_line)
Karsten Hopp d706e6
! 		update_single_line(curwin, conceal_old_cursor_line);
Karsten Hopp d706e6
! 	    update_single_line(curwin, conceal_new_cursor_line == 0
Karsten Hopp d706e6
! 			   ? curwin->w_cursor.lnum : conceal_new_cursor_line);
Karsten Hopp d706e6
! 	    curwin->w_valid &= ~VALID_CROW;
Karsten Hopp d706e6
! 	}
Karsten Hopp d706e6
! # endif
Karsten Hopp d706e6
! 	showruler(FALSE);
Karsten Hopp d706e6
! 	setcursor();
Karsten Hopp d706e6
! 	emsg_on_display = FALSE;	/* may remove error message now */
Karsten Hopp d706e6
      }
Karsten Hopp d706e6
  }
Karsten Hopp d706e6
  
Karsten Hopp d706e6
  /*
Karsten Hopp d706e6
--- 1556,1644 ----
Karsten Hopp d706e6
      int		conceal_update_lines = FALSE;
Karsten Hopp d706e6
  #endif
Karsten Hopp d706e6
  
Karsten Hopp d706e6
!     if (char_avail())
Karsten Hopp d706e6
! 	return;
Karsten Hopp d706e6
! 
Karsten Hopp d706e6
  #if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
Karsten Hopp d706e6
!     /* Trigger CursorMoved if the cursor moved.  Not when the popup menu is
Karsten Hopp d706e6
!      * visible, the command might delete it. */
Karsten Hopp d706e6
!     if (ready && (
Karsten Hopp d706e6
  # ifdef FEAT_AUTOCMD
Karsten Hopp d706e6
! 		has_cursormovedI()
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
  # if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL)
Karsten Hopp d706e6
! 		||
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
  # ifdef FEAT_CONCEAL
Karsten Hopp d706e6
! 		curwin->w_p_cole > 0
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
! 		)
Karsten Hopp d706e6
! 	&& !equalpos(last_cursormoved, curwin->w_cursor)
Karsten Hopp d706e6
  # ifdef FEAT_INS_EXPAND
Karsten Hopp d706e6
! 	&& !pum_visible()
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
!        )
Karsten Hopp d706e6
!     {
Karsten Hopp d706e6
  # ifdef FEAT_SYN_HL
Karsten Hopp d706e6
! 	/* Need to update the screen first, to make sure syntax
Karsten Hopp d706e6
! 	 * highlighting is correct after making a change (e.g., inserting
Karsten Hopp d706e6
! 	 * a "(".  The autocommand may also require a redraw, so it's done
Karsten Hopp d706e6
! 	 * again below, unfortunately. */
Karsten Hopp d706e6
! 	if (syntax_present(curwin) && must_redraw)
Karsten Hopp d706e6
! 	    update_screen(0);
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
  # ifdef FEAT_AUTOCMD
Karsten Hopp d706e6
! 	if (has_cursormovedI())
Karsten Hopp d706e6
! 	    apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf);
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
  # ifdef FEAT_CONCEAL
Karsten Hopp d706e6
! 	if (curwin->w_p_cole > 0)
Karsten Hopp d706e6
! 	{
Karsten Hopp d706e6
! 	    conceal_old_cursor_line = last_cursormoved.lnum;
Karsten Hopp d706e6
! 	    conceal_new_cursor_line = curwin->w_cursor.lnum;
Karsten Hopp d706e6
! 	    conceal_update_lines = TRUE;
Karsten Hopp d706e6
  	}
Karsten Hopp d706e6
+ # endif
Karsten Hopp d706e6
+ 	last_cursormoved = curwin->w_cursor;
Karsten Hopp d706e6
+     }
Karsten Hopp d706e6
  #endif
Karsten Hopp d706e6
+ 
Karsten Hopp d706e6
  #ifdef FEAT_AUTOCMD
Karsten Hopp d706e6
!     /* Trigger TextChangedI if b_changedtick differs. */
Karsten Hopp d706e6
!     if (ready && has_textchangedI()
Karsten Hopp d706e6
! 	    && last_changedtick != curbuf->b_changedtick
Karsten Hopp d706e6
  # ifdef FEAT_INS_EXPAND
Karsten Hopp d706e6
! 	    && !pum_visible()
Karsten Hopp d706e6
  # endif
Karsten Hopp d706e6
! 	    )
Karsten Hopp d706e6
!     {
Karsten Hopp d706e6
! 	if (last_changedtick_buf == curbuf)
Karsten Hopp d706e6
! 	    apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
Karsten Hopp d706e6
! 	last_changedtick_buf = curbuf;
Karsten Hopp d706e6
! 	last_changedtick = curbuf->b_changedtick;
Karsten Hopp d706e6
!     }
Karsten Hopp d706e6
  #endif
Karsten Hopp d706e6
! 
Karsten Hopp d706e6
!     if (must_redraw)
Karsten Hopp d706e6
! 	update_screen(0);
Karsten Hopp d706e6
!     else if (clear_cmdline || redraw_cmdline)
Karsten Hopp d706e6
! 	showmode();		/* clear cmdline and show mode */
Karsten Hopp d706e6
  # if defined(FEAT_CONCEAL)
Karsten Hopp d706e6
!     if ((conceal_update_lines
Karsten Hopp d706e6
! 	    && (conceal_old_cursor_line != conceal_new_cursor_line
Karsten Hopp d706e6
! 		|| conceal_cursor_line(curwin)))
Karsten Hopp d706e6
! 	    || need_cursor_line_redraw)
Karsten Hopp d706e6
!     {
Karsten Hopp d706e6
! 	if (conceal_old_cursor_line != conceal_new_cursor_line)
Karsten Hopp d706e6
! 	    update_single_line(curwin, conceal_old_cursor_line);
Karsten Hopp d706e6
! 	update_single_line(curwin, conceal_new_cursor_line == 0
Karsten Hopp d706e6
! 		       ? curwin->w_cursor.lnum : conceal_new_cursor_line);
Karsten Hopp d706e6
! 	curwin->w_valid &= ~VALID_CROW;
Karsten Hopp d706e6
      }
Karsten Hopp d706e6
+ # endif
Karsten Hopp d706e6
+     showruler(FALSE);
Karsten Hopp d706e6
+     setcursor();
Karsten Hopp d706e6
+     emsg_on_display = FALSE;	/* may remove error message now */
Karsten Hopp d706e6
  }
Karsten Hopp d706e6
  
Karsten Hopp d706e6
  /*
Karsten Hopp d706e6
*** ../vim-7.4.142/src/version.c	2014-01-12 13:24:46.000000000 +0100
Karsten Hopp d706e6
--- src/version.c	2014-01-14 12:15:50.000000000 +0100
Karsten Hopp d706e6
***************
Karsten Hopp d706e6
*** 740,741 ****
Karsten Hopp d706e6
--- 740,743 ----
Karsten Hopp d706e6
  {   /* Add new patch number below this line */
Karsten Hopp d706e6
+ /**/
Karsten Hopp d706e6
+     143,
Karsten Hopp d706e6
  /**/
Karsten Hopp d706e6
Karsten Hopp d706e6
-- 
Karsten Hopp d706e6
You are not really successful until someone claims he sat
Karsten Hopp d706e6
beside you in school.
Karsten Hopp d706e6
Karsten Hopp d706e6
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp d706e6
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp d706e6
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp d706e6
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///