diff options
-rw-r--r-- | runtime/plugin/matchparen.vim | 4 | ||||
-rw-r--r-- | src/nvim/eval.c | 43 | ||||
-rw-r--r-- | src/nvim/message.c | 23 | ||||
-rw-r--r-- | src/nvim/screen.c | 8 | ||||
-rw-r--r-- | src/nvim/version.c | 8 | ||||
-rw-r--r-- | test/functional/ex_cmds/cd_spec.lua | 12 | ||||
-rw-r--r-- | test/unit/tempfile_spec.lua | 3 |
7 files changed, 62 insertions, 39 deletions
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index 2a5a16a57e..873302efee 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -1,6 +1,6 @@ " Vim plugin for showing matching parens " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Jul 19 +" Last Change: 2015 Dec 31 " Exit quickly when: " - this plugin was already loaded (or disabled) @@ -55,7 +55,7 @@ function! s:Highlight_Matching_Pair() let before = 0 let text = getline(c_lnum) - let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\)') + let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\=\)') if empty(matches) let [c_before, c] = ['', ''] else diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d84bdfebfe..9e23753833 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8337,6 +8337,7 @@ static void f_cursor(typval_T *argvars, typval_T *rettv) { long line, col; long coladd = 0; + bool set_curswant = true; rettv->vval.v_number = -1; if (argvars[1].v_type == VAR_UNKNOWN) { @@ -8353,30 +8354,35 @@ static void f_cursor(typval_T *argvars, typval_T *rettv) coladd = pos.coladd; if (curswant >= 0) { curwin->w_curswant = curswant - 1; + set_curswant = false; } } else { line = get_tv_lnum(argvars); col = get_tv_number_chk(&argvars[1], NULL); - if (argvars[2].v_type != VAR_UNKNOWN) + if (argvars[2].v_type != VAR_UNKNOWN) { coladd = get_tv_number_chk(&argvars[2], NULL); + } } if (line < 0 || col < 0 - || coladd < 0 - ) - return; /* type error; errmsg already given */ - if (line > 0) + || coladd < 0) { + return; // type error; errmsg already given + } + if (line > 0) { curwin->w_cursor.lnum = line; - if (col > 0) + } + if (col > 0) { curwin->w_cursor.col = col - 1; + } curwin->w_cursor.coladd = coladd; - /* Make sure the cursor is in a valid position. */ + // Make sure the cursor is in a valid position. check_cursor(); - /* Correct cursor for multi-byte character. */ - if (has_mbyte) + // Correct cursor for multi-byte character. + if (has_mbyte) { mb_adjust_cursor(); + } - curwin->w_set_curswant = TRUE; + curwin->w_set_curswant = set_curswant; rettv->vval.v_number = 0; } @@ -14682,25 +14688,30 @@ static void f_setpos(typval_T *argvars, typval_T *rettv) name = get_tv_string_chk(argvars); if (name != NULL) { if (list2fpos(&argvars[1], &pos, &fnum, &curswant) == OK) { - if (--pos.col < 0) + if (--pos.col < 0) { pos.col = 0; + } if (name[0] == '.' && name[1] == NUL) { - /* set cursor */ + // set cursor if (fnum == curbuf->b_fnum) { curwin->w_cursor = pos; if (curswant >= 0) { curwin->w_curswant = curswant - 1; + curwin->w_set_curswant = false; } check_cursor(); rettv->vval.v_number = 0; - } else + } else { EMSG(_(e_invarg)); + } } else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) { - /* set mark */ - if (setmark_pos(name[1], &pos, fnum) == OK) + // set mark + if (setmark_pos(name[1], &pos, fnum) == OK) { rettv->vval.v_number = 0; - } else + } + } else { EMSG(_(e_invarg)); + } } } } diff --git a/src/nvim/message.c b/src/nvim/message.c index f60b128712..265f8c00c0 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -467,22 +467,23 @@ int emsg(char_u *s) { int attr; char_u *p; - int ignore = FALSE; + int ignore = false; int severe; - /* Skip this if not giving error messages at the moment. */ - if (emsg_not_now()) - return TRUE; + // Skip this if not giving error messages at the moment. + if (emsg_not_now()) { + return true; + } - called_emsg = TRUE; - ex_exitval = 1; + called_emsg = true; + if (emsg_silent == 0) { + ex_exitval = 1; + } - /* - * If "emsg_severe" is TRUE: When an error exception is to be thrown, - * prefer this message over previous messages for the same command. - */ + // If "emsg_severe" is TRUE: When an error exception is to be thrown, + // prefer this message over previous messages for the same command. severe = emsg_severe; - emsg_severe = FALSE; + emsg_severe = false; if (!emsg_off || vim_strchr(p_debug, 't') != NULL) { /* diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 59168b29a0..10b5b6bba4 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3693,9 +3693,13 @@ win_line ( && wp == curwin && lnum == wp->w_cursor.lnum && conceal_cursor_line(wp) && (int)wp->w_virtcol <= vcol + n_skip) { - wp->w_wcol = col - boguscols; + if (wp->w_p_rl) { + wp->w_wcol = wp->w_width - col + boguscols - 1; + } else { + wp->w_wcol = col - boguscols; + } wp->w_wrow = row; - did_wcol = TRUE; + did_wcol = true; } /* Don't override visual selection highlighting. */ diff --git a/src/nvim/version.c b/src/nvim/version.c index 723eceee2e..69d423f531 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -116,7 +116,7 @@ static int included_patches[] = { // 1565, // 1564, // 1563, - // 1562, + // 1562 NA // 1561 NA // 1560, // 1559, @@ -331,7 +331,7 @@ static int included_patches[] = { // 1350 NA // 1349 NA // 1348 NA - // 1347, + 1347, 1346, // 1345 NA // 1344 NA @@ -577,7 +577,7 @@ static int included_patches[] = { // 1104 NA // 1103 NA // 1102, - // 1101, + 1101, // 1100 NA // 1099 NA // 1098 NA @@ -663,7 +663,7 @@ static int included_patches[] = { // 1018, // 1017, // 1016 NA - // 1015, + 1015, // 1014 NA 1013, // 1012 NA diff --git a/test/functional/ex_cmds/cd_spec.lua b/test/functional/ex_cmds/cd_spec.lua index b503eba46e..69467632a4 100644 --- a/test/functional/ex_cmds/cd_spec.lua +++ b/test/functional/ex_cmds/cd_spec.lua @@ -53,7 +53,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do eq(0, wlwd()) -- Change tab-local working directory and verify it is different - execute('t' .. cmd .. ' ' .. directories[1]) + execute('silent t' .. cmd .. ' ' .. directories[1]) eq(globalDir .. '/' .. directories[1], cwd()) eq(cwd(), tcwd()) -- working directory maches tab directory eq(1, tlwd()) @@ -65,7 +65,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do eq(1, tlwd()) -- Still tab-local working directory eq(0, wlwd()) -- Still no window-local working directory eq(globalDir .. '/' .. directories[1], cwd()) - execute('l' .. cmd .. ' ../' .. directories[2]) + execute('silent l' .. cmd .. ' ../' .. directories[2]) eq(globalDir .. '/' .. directories[2], cwd()) eq(globalDir .. '/' .. directories[1], tcwd()) eq(1, wlwd()) @@ -83,7 +83,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do eq(0, wlwd()) -- Verify global changes don't affect local ones - execute('' .. cmd .. ' ' .. directories[3]) + execute('silent ' .. cmd .. ' ' .. directories[3]) eq(globalDir .. '/' .. directories[3], cwd()) execute('tabnext') eq(globalDir .. '/' .. directories[1], cwd()) @@ -91,7 +91,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do eq(0, wlwd()) -- Still no window-local directory in this window -- Unless the global change happened in a tab with local directory - execute('' .. cmd .. ' ..') + execute('silent ' .. cmd .. ' ..') eq(globalDir, cwd() ) eq(0 , tlwd()) eq(0 , wlwd()) @@ -111,6 +111,10 @@ end -- Test legal parameters for 'getcwd' and 'haslocaldir' for _, cmd in ipairs {'getcwd', 'haslocaldir'} do describe(cmd..'()', function() + before_each(function() + clear() + end) + -- Test invalid argument types local err474 = 'Vim(call):E474: Invalid argument' it('fails on string', function() diff --git a/test/unit/tempfile_spec.lua b/test/unit/tempfile_spec.lua index b3e84db132..7975d11aed 100644 --- a/test/unit/tempfile_spec.lua +++ b/test/unit/tempfile_spec.lua @@ -5,6 +5,9 @@ local os = helpers.cimport './src/nvim/os/os.h' local tempfile = helpers.cimport './src/nvim/fileio.h' describe('tempfile related functions', function() + before_each(function() + tempfile.vim_deltempdir() + end) after_each(function() tempfile.vim_deltempdir() end) |