diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-07-21 14:40:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-21 14:40:32 +0200 |
commit | 9d0f8224c97b36116f3c0523bcf6941382892a5b (patch) | |
tree | 474781d9dd71c62ab9377faa1641321c173f1a85 /src | |
parent | d20bbc802245cc14176028bf209ae3a7e81e21c4 (diff) | |
parent | a63b95b315673354df9c42efcff248cacca45669 (diff) | |
download | rneovim-9d0f8224c97b36116f3c0523bcf6941382892a5b.tar.gz rneovim-9d0f8224c97b36116f3c0523bcf6941382892a5b.tar.bz2 rneovim-9d0f8224c97b36116f3c0523bcf6941382892a5b.zip |
Merge #10555 from janlazo/vim-8.1.1720
vim-patch:8.1.{856,1720}
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/move.c | 4 | ||||
-rw-r--r-- | src/nvim/normal.c | 3 | ||||
-rw-r--r-- | src/nvim/regexp.c | 11 | ||||
-rw-r--r-- | src/nvim/screen.c | 32 | ||||
-rw-r--r-- | src/nvim/testdir/test_regexp_utf8.vim | 9 |
5 files changed, 41 insertions, 18 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index 18a138acfd..b9c4196251 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -103,7 +103,8 @@ void reset_cursorline(void) } // Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set. -static void redraw_for_cursorline(win_T *wp) +void redraw_for_cursorline(win_T *wp) + FUNC_ATTR_NONNULL_ALL { if ((wp->w_p_rnu || win_cursorline_standout(wp)) && (wp->w_valid & VALID_CROW) == 0 @@ -122,7 +123,6 @@ static void redraw_for_cursorline(win_T *wp) } else { redraw_win_later(wp, SOME_VALID); } - wp->w_last_cursorline = wp->w_cursor.lnum; } } } diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 83853302b4..d33c5d33bb 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -4038,6 +4038,9 @@ static void nv_mousescroll(cmdarg_T *cap) } else { mouse_scroll_horiz(cap->arg); } + if (curwin != old_curwin && curwin->w_p_cul) { + redraw_for_cursorline(curwin); + } curwin->w_redr_status = true; diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 8598da6376..eb1e565b1f 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -2058,10 +2058,14 @@ static char_u *regatom(int *flagp) EMSG2_RET_NULL(_(e_missing_sb), reg_magic == MAGIC_ALL); br = regnode(BRANCH); - if (ret == NULL) + if (ret == NULL) { ret = br; - else + } else { regtail(lastnode, br); + if (reg_toolong) { + return NULL; + } + } ungetchr(); one_exactly = TRUE; @@ -2083,6 +2087,9 @@ static char_u *regatom(int *flagp) for (br = ret; br != lastnode; ) { if (OP(br) == BRANCH) { regtail(br, lastbranch); + if (reg_toolong) { + return NULL; + } br = OPERAND(br); } else br = regnext(br); diff --git a/src/nvim/screen.c b/src/nvim/screen.c index fd2a07e890..ab9f71ed6c 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -171,6 +171,7 @@ void redraw_later(int type) } void redraw_win_later(win_T *wp, int type) + FUNC_ATTR_NONNULL_ALL { if (!exiting && wp->w_redr_type < type) { wp->w_redr_type = type; @@ -243,6 +244,7 @@ redrawWinline( win_T *wp, linenr_T lnum ) + FUNC_ATTR_NONNULL_ALL { if (lnum >= wp->w_topline && lnum < wp->w_botline) { @@ -518,26 +520,27 @@ int update_screen(int type) return OK; } -/* - * Return TRUE if the cursor line in window "wp" may be concealed, according - * to the 'concealcursor' option. - */ -int conceal_cursor_line(win_T *wp) +// Return true if the cursor line in window "wp" may be concealed, according +// to the 'concealcursor' option. +bool conceal_cursor_line(const win_T *wp) + FUNC_ATTR_NONNULL_ALL { int c; - if (*wp->w_p_cocu == NUL) - return FALSE; - if (get_real_state() & VISUAL) + if (*wp->w_p_cocu == NUL) { + return false; + } + if (get_real_state() & VISUAL) { c = 'v'; - else if (State & INSERT) + } else if (State & INSERT) { c = 'i'; - else if (State & NORMAL) + } else if (State & NORMAL) { c = 'n'; - else if (State & CMDLINE) + } else if (State & CMDLINE) { c = 'c'; - else - return FALSE; + } else { + return false; + } return vim_strchr(wp->w_p_cocu, c) != NULL; } @@ -559,7 +562,8 @@ void conceal_check_cursor_line(void) /// /// If true, both old and new cursorline will need /// need to be redrawn when moving cursor within windows. -bool win_cursorline_standout(win_T *wp) +bool win_cursorline_standout(const win_T *wp) + FUNC_ATTR_NONNULL_ALL { return wp->w_p_cul || (wp->w_p_cole > 0 && !conceal_cursor_line(wp)); } diff --git a/src/nvim/testdir/test_regexp_utf8.vim b/src/nvim/testdir/test_regexp_utf8.vim index 97638e9aac..e06c7d6368 100644 --- a/src/nvim/testdir/test_regexp_utf8.vim +++ b/src/nvim/testdir/test_regexp_utf8.vim @@ -183,3 +183,12 @@ func Test_large_class() call assert_equal(1, "\u3042" =~# '[\u3000-\u4000]') set re=0 endfunc + +func Test_optmatch_toolong() + set re=1 + " Can only handle about 8000 characters. + let pat = '\\%[' .. repeat('x', 9000) .. ']' + call assert_fails('call match("abc def", "' .. pat .. '")', 'E339:') + set re=0 +endfunc + |