comparison src/edit.c @ 5592:d11f223f4c75 v7.4.143

updated for version 7.4.143 Problem: TextChangedI is not triggered. Solution: Reverse check for "ready". (lilydjwg)
author Bram Moolenaar <bram@vim.org>
date Tue, 14 Jan 2014 12:17:02 +0100
parents faf7e86203b5
children a95a151402be
comparison
equal deleted inserted replaced
5591:cbf36118ff2c 5592:d11f223f4c75
1554 linenr_T conceal_old_cursor_line = 0; 1554 linenr_T conceal_old_cursor_line = 0;
1555 linenr_T conceal_new_cursor_line = 0; 1555 linenr_T conceal_new_cursor_line = 0;
1556 int conceal_update_lines = FALSE; 1556 int conceal_update_lines = FALSE;
1557 #endif 1557 #endif
1558 1558
1559 if (!char_avail()) 1559 if (char_avail())
1560 { 1560 return;
1561
1561 #if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) 1562 #if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
1562 /* Trigger CursorMoved if the cursor moved. Not when the popup menu is 1563 /* Trigger CursorMoved if the cursor moved. Not when the popup menu is
1563 * visible, the command might delete it. */ 1564 * visible, the command might delete it. */
1564 if (ready && ( 1565 if (ready && (
1565 # ifdef FEAT_AUTOCMD 1566 # ifdef FEAT_AUTOCMD
1566 has_cursormovedI() 1567 has_cursormovedI()
1567 # endif 1568 # endif
1568 # if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL) 1569 # if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL)
1569 || 1570 ||
1570 # endif 1571 # endif
1571 # ifdef FEAT_CONCEAL 1572 # ifdef FEAT_CONCEAL
1572 curwin->w_p_cole > 0 1573 curwin->w_p_cole > 0
1573 # endif 1574 # endif
1574 ) 1575 )
1575 && !equalpos(last_cursormoved, curwin->w_cursor) 1576 && !equalpos(last_cursormoved, curwin->w_cursor)
1577 # ifdef FEAT_INS_EXPAND
1578 && !pum_visible()
1579 # endif
1580 )
1581 {
1582 # ifdef FEAT_SYN_HL
1583 /* Need to update the screen first, to make sure syntax
1584 * highlighting is correct after making a change (e.g., inserting
1585 * a "(". The autocommand may also require a redraw, so it's done
1586 * again below, unfortunately. */
1587 if (syntax_present(curwin) && must_redraw)
1588 update_screen(0);
1589 # endif
1590 # ifdef FEAT_AUTOCMD
1591 if (has_cursormovedI())
1592 apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf);
1593 # endif
1594 # ifdef FEAT_CONCEAL
1595 if (curwin->w_p_cole > 0)
1596 {
1597 conceal_old_cursor_line = last_cursormoved.lnum;
1598 conceal_new_cursor_line = curwin->w_cursor.lnum;
1599 conceal_update_lines = TRUE;
1600 }
1601 # endif
1602 last_cursormoved = curwin->w_cursor;
1603 }
1604 #endif
1605
1606 #ifdef FEAT_AUTOCMD
1607 /* Trigger TextChangedI if b_changedtick differs. */
1608 if (ready && has_textchangedI()
1609 && last_changedtick != curbuf->b_changedtick
1576 # ifdef FEAT_INS_EXPAND 1610 # ifdef FEAT_INS_EXPAND
1577 && !pum_visible() 1611 && !pum_visible()
1578 # endif 1612 # endif
1579 ) 1613 )
1580 { 1614 {
1581 # ifdef FEAT_SYN_HL 1615 if (last_changedtick_buf == curbuf)
1582 /* Need to update the screen first, to make sure syntax 1616 apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
1583 * highlighting is correct after making a change (e.g., inserting 1617 last_changedtick_buf = curbuf;
1584 * a "(". The autocommand may also require a redraw, so it's done 1618 last_changedtick = curbuf->b_changedtick;
1585 * again below, unfortunately. */ 1619 }
1586 if (syntax_present(curwin) && must_redraw) 1620 #endif
1587 update_screen(0); 1621
1622 if (must_redraw)
1623 update_screen(0);
1624 else if (clear_cmdline || redraw_cmdline)
1625 showmode(); /* clear cmdline and show mode */
1626 # if defined(FEAT_CONCEAL)
1627 if ((conceal_update_lines
1628 && (conceal_old_cursor_line != conceal_new_cursor_line
1629 || conceal_cursor_line(curwin)))
1630 || need_cursor_line_redraw)
1631 {
1632 if (conceal_old_cursor_line != conceal_new_cursor_line)
1633 update_single_line(curwin, conceal_old_cursor_line);
1634 update_single_line(curwin, conceal_new_cursor_line == 0
1635 ? curwin->w_cursor.lnum : conceal_new_cursor_line);
1636 curwin->w_valid &= ~VALID_CROW;
1637 }
1588 # endif 1638 # endif
1589 # ifdef FEAT_AUTOCMD 1639 showruler(FALSE);
1590 if (has_cursormovedI()) 1640 setcursor();
1591 apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf); 1641 emsg_on_display = FALSE; /* may remove error message now */
1592 # endif
1593 # ifdef FEAT_CONCEAL
1594 if (curwin->w_p_cole > 0)
1595 {
1596 conceal_old_cursor_line = last_cursormoved.lnum;
1597 conceal_new_cursor_line = curwin->w_cursor.lnum;
1598 conceal_update_lines = TRUE;
1599 }
1600 # endif
1601 last_cursormoved = curwin->w_cursor;
1602 }
1603 #endif
1604 #ifdef FEAT_AUTOCMD
1605 /* Trigger TextChangedI if b_changedtick differs. */
1606 if (!ready && has_textchangedI()
1607 && last_changedtick != curbuf->b_changedtick
1608 # ifdef FEAT_INS_EXPAND
1609 && !pum_visible()
1610 # endif
1611 )
1612 {
1613 if (last_changedtick_buf == curbuf)
1614 apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
1615 last_changedtick_buf = curbuf;
1616 last_changedtick = curbuf->b_changedtick;
1617 }
1618 #endif
1619 if (must_redraw)
1620 update_screen(0);
1621 else if (clear_cmdline || redraw_cmdline)
1622 showmode(); /* clear cmdline and show mode */
1623 # if defined(FEAT_CONCEAL)
1624 if ((conceal_update_lines
1625 && (conceal_old_cursor_line != conceal_new_cursor_line
1626 || conceal_cursor_line(curwin)))
1627 || need_cursor_line_redraw)
1628 {
1629 if (conceal_old_cursor_line != conceal_new_cursor_line)
1630 update_single_line(curwin, conceal_old_cursor_line);
1631 update_single_line(curwin, conceal_new_cursor_line == 0
1632 ? curwin->w_cursor.lnum : conceal_new_cursor_line);
1633 curwin->w_valid &= ~VALID_CROW;
1634 }
1635 # endif
1636 showruler(FALSE);
1637 setcursor();
1638 emsg_on_display = FALSE; /* may remove error message now */
1639 }
1640 } 1642 }
1641 1643
1642 /* 1644 /*
1643 * Handle a CTRL-V or CTRL-Q typed in Insert mode. 1645 * Handle a CTRL-V or CTRL-Q typed in Insert mode.
1644 */ 1646 */