diff options
author | Bram Moolenaar <bram@vim.org> | 2012-03-16 19:07:58 +0100 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2012-03-16 19:07:58 +0100 |
commit | acae400329989a7598e53452845a055c5daeba94 (patch) | |
tree | 05ace3580574cc9ddeba4af3a01212b346f25073 | |
parent | 4563fbcd4b0de962f71207f5cf83db00be5640d2 (diff) | |
download | vim-acae400329989a7598e53452845a055c5daeba94.tar.gz |
Problem: Crash when using ":redraw" in a BufEnter autocommand and
switching to another tab. (驼峰)
Solution: Move triggering the the autocommands to after correcting the
option values. Also check the row value to be out of bounds.
(Christian Brabandt, Sergey Khorev)
-rw-r--r-- | src/screen.c | 6 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/window.c | 15 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/screen.c b/src/screen.c index 9bac8bce..97d636d7 100644 --- a/src/screen.c +++ b/src/screen.c @@ -5371,6 +5371,12 @@ screen_line(row, coloff, endcol, clear_width # define CHAR_CELLS 1 #endif + /* Check for illegal row and col, just in case. */ + if (row >= Rows) + row = Rows - 1; + if (endcol > Columns) + endcol = Columns; + # ifdef FEAT_CLIPBOARD clip_may_clear_selection(row, row); # endif diff --git a/src/version.c b/src/version.c index 41d967af..f52d9fa4 100644 --- a/src/version.c +++ b/src/version.c @@ -715,6 +715,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 472, +/**/ 471, /**/ 470, diff --git a/src/window.c b/src/window.c index 6c02570f..0a0a2d49 100644 --- a/src/window.c +++ b/src/window.c @@ -3676,13 +3676,6 @@ enter_tabpage(tp, old_curbuf) win_enter_ext(tp->tp_curwin, FALSE, TRUE); prevwin = next_prevwin; -#ifdef FEAT_AUTOCMD - apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf); - - if (old_curbuf != curbuf) - apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); -#endif - last_status(FALSE); /* status line may appear or disappear */ (void)win_comp_pos(); /* recompute w_winrow for all windows */ must_redraw = CLEAR; /* need to redraw everything */ @@ -3712,6 +3705,14 @@ enter_tabpage(tp, old_curbuf) gui_may_update_scrollbars(); #endif +#ifdef FEAT_AUTOCMD + /* Apply autocommands after updating the display, when 'rows' and + * 'columns' have been set correctly. */ + apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf); + if (old_curbuf != curbuf) + apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); +#endif + redraw_all_later(CLEAR); } |