From ae01a5e9f8cde646f369bdf9c6cf1f8679204291 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 5 May 2020 22:16:15 -0400 Subject: vim-patch:8.1.1186: readdir() allocates list twice Problem: readdir() allocates list twice. Solution: Remove second allocation. Also check for zero length. https://github.com/vim/vim/commit/334ad415040f9592451ec99498cd99f90d6e33e6 --- src/nvim/eval/funcs.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 217490ad10..c7df1d6753 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -6393,20 +6393,14 @@ static void f_readdir(typval_T *argvars, typval_T *rettv, FunPtr fptr) os_closedir(&dir); } - rettv->vval.v_list = tv_list_alloc(kListLenShouldKnow); - if (rettv->vval.v_list != NULL) { - tv_list_ref(rettv->vval.v_list); + if (rettv->vval.v_list != NULL && ga.ga_len > 0) { sort_strings((char_u **)ga.ga_data, ga.ga_len); for (int i = 0; i < ga.ga_len; i++) { path = ((const char **)ga.ga_data)[i]; tv_list_append_string(rettv->vval.v_list, path, -1); } } - for (int i = 0; i < ga.ga_len; i++) { - xfree(((uint8_t **)ga.ga_data)[i]); - } - - ga_clear(&ga); + ga_clear_strings(&ga); } /* -- cgit From 393dc2b0f5f6bdbaa4499d07e9a1d90d924d6441 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 7 May 2020 23:10:39 -0400 Subject: vim-patch:8.2.0713: the pam_environment file is not recognized Problem: The pam_environment file is not recognized. Solution: Add a filetype pattern for pamenv. (closes vim/vim#6051) https://github.com/vim/vim/commit/611548105394fdb76827cd431230c9fbfed39929 --- src/nvim/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index a9984acdd9..4ca2e82ce1 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -321,6 +321,7 @@ let s:filename_checks = { \ 'openroad': ['file.or'], \ 'ora': ['file.ora'], \ 'pamconf': ['/etc/pam.conf'], + \ 'pamenv': ['/home/user/.pam_environment'], \ 'papp': ['file.papp', 'file.pxml', 'file.pxsl'], \ 'pascal': ['file.pas', 'file.dpr'], \ 'passwd': ['any/etc/passwd', 'any/etc/passwd-', 'any/etc/passwd.edit', 'any/etc/shadow', 'any/etc/shadow-', 'any/etc/shadow.edit', 'any/var/backups/passwd.bak', 'any/var/backups/shadow.bak'], -- cgit From 801c8e06d60279d059073e0cf6901d43f6b3cc85 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 10 May 2020 23:21:43 -0400 Subject: vim-patch:8.2.0308: 'showbreak' does not work for a very long line Problem: 'showbreak' does not work for a very long line. (John Little) Solution: Check whether 'briopt' contains "sbr". (Ken Takata, closes vim/vim#5523, closes vim/vim#5684) https://github.com/vim/vim/commit/1aa76b8fd06c278fe36c39b0bbe7233c775d7423 --- src/nvim/screen.c | 2 +- src/nvim/testdir/test_breakindent.vim | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 8f8bfee60c..a165ce2586 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2994,7 +2994,7 @@ win_line ( c_final = NUL; n_extra = get_breakindent_win(wp, ml_get_buf(wp->w_buffer, lnum, false)); - if (wp->w_skipcol > 0 && wp->w_p_wrap) { + if (wp->w_skipcol > 0 && wp->w_p_wrap && wp->w_p_brisbr) { need_showbreak = false; } // Correct end of highlighted area for 'breakindent', diff --git a/src/nvim/testdir/test_breakindent.vim b/src/nvim/testdir/test_breakindent.vim index 6d88f1dc5a..5675bf74dd 100644 --- a/src/nvim/testdir/test_breakindent.vim +++ b/src/nvim/testdir/test_breakindent.vim @@ -361,5 +361,15 @@ func Test_breakindent19_sbr_nextpage() \ "> aaaaaaaaaaaaaaaaaa", \ ] call s:compare_lines(expect, lines) + + setl breakindent briopt=min:18 sbr=> + norm! 5gj + let lines = s:screen_lines(1, 20) + let expect = [ + \ ">aaaaaaaaaaaaaaaaaaa", + \ ">aaaaaaaaaaaaaaaaaaa", + \ ">aaaaaaaaaaaaaaaaaaa", + \ ] + call s:compare_lines(expect, lines) call s:close_windows('set breakindent& briopt& sbr&') endfunc -- cgit From adcabb73bc48732df420e9de7b067ebba2f25f55 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 10 May 2020 23:36:05 -0400 Subject: vim-patch:8.2.0309: window-local values have confusing name Problem: Window-local values have confusing name. Solution: Rename w_p_bri* to w_briopt_*. https://github.com/vim/vim/commit/b81f56fb57c87a7490dd79908c257437d1958447 --- src/nvim/buffer_defs.h | 7 ++++--- src/nvim/indent.c | 10 +++++----- src/nvim/option.c | 6 +++--- src/nvim/screen.c | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index b87a2ba721..d696eedbb7 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1330,12 +1330,13 @@ struct window_S { uint32_t w_p_fde_flags; // flags for 'foldexpr' uint32_t w_p_fdt_flags; // flags for 'foldtext' int *w_p_cc_cols; // array of columns to highlight or NULL - int w_p_brimin; // minimum width for breakindent - int w_p_brishift; // additional shift for breakindent - bool w_p_brisbr; // sbr in 'briopt' long w_p_siso; // 'sidescrolloff' local value long w_p_so; // 'scrolloff' local value + int w_briopt_min; // minimum width for breakindent + int w_briopt_shift; // additional shift for breakindent + bool w_briopt_sbr; // sbr in 'briopt' + // transform a pointer to a "onebuf" option into a "allbuf" option #define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T)) diff --git a/src/nvim/indent.c b/src/nvim/indent.c index 7f17fb0035..fb277b25fd 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -398,10 +398,10 @@ int get_breakindent_win(win_T *wp, const char_u *line) prev_tick = buf_get_changedtick(wp->w_buffer); prev_indent = get_indent_str(line, (int)wp->w_buffer->b_p_ts, wp->w_p_list); } - bri = prev_indent + wp->w_p_brishift; + bri = prev_indent + wp->w_briopt_shift; // indent minus the length of the showbreak string - if (wp->w_p_brisbr) { + if (wp->w_briopt_sbr) { bri -= vim_strsize(p_sbr); } // Add offset for number column, if 'n' is in 'cpoptions' @@ -410,11 +410,11 @@ int get_breakindent_win(win_T *wp, const char_u *line) // never indent past left window margin if (bri < 0) { bri = 0; - } else if (bri > eff_wwidth - wp->w_p_brimin) { + } else if (bri > eff_wwidth - wp->w_briopt_min) { // always leave at least bri_min characters on the left, // if text width is sufficient - bri = (eff_wwidth - wp->w_p_brimin < 0) - ? 0 : eff_wwidth - wp->w_p_brimin; + bri = (eff_wwidth - wp->w_briopt_min < 0) + ? 0 : eff_wwidth - wp->w_briopt_min; } return bri; diff --git a/src/nvim/option.c b/src/nvim/option.c index 84ace55d91..96f8e1529a 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -7229,9 +7229,9 @@ static bool briopt_check(win_T *wp) } } - wp->w_p_brishift = bri_shift; - wp->w_p_brimin = bri_min; - wp->w_p_brisbr = bri_sbr; + wp->w_briopt_shift = bri_shift; + wp->w_briopt_min = bri_min; + wp->w_briopt_sbr = bri_sbr; return true; } diff --git a/src/nvim/screen.c b/src/nvim/screen.c index a165ce2586..9e958663aa 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2966,11 +2966,11 @@ win_line ( } } - if (wp->w_p_brisbr && draw_state == WL_BRI - 1 + if (wp->w_briopt_sbr && draw_state == WL_BRI - 1 && n_extra == 0 && *p_sbr != NUL) { // draw indent after showbreak value draw_state = WL_BRI; - } else if (wp->w_p_brisbr && draw_state == WL_SBR && n_extra == 0) { + } else if (wp->w_briopt_sbr && draw_state == WL_SBR && n_extra == 0) { // after the showbreak, draw the breakindent draw_state = WL_BRI - 1; } @@ -2994,7 +2994,7 @@ win_line ( c_final = NUL; n_extra = get_breakindent_win(wp, ml_get_buf(wp->w_buffer, lnum, false)); - if (wp->w_skipcol > 0 && wp->w_p_wrap && wp->w_p_brisbr) { + if (wp->w_skipcol > 0 && wp->w_p_wrap && wp->w_briopt_sbr) { need_showbreak = false; } // Correct end of highlighted area for 'breakindent', -- cgit From 076b0949d045d19decb2625c04128200ce8a987f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 11 May 2020 23:56:53 -0400 Subject: vim-patch:8.2.0736: some files not recognized as pamenv Problem: Some files not recognized as pamenv. Solution: Add pam_inv.conf. (closes vim/vim#6065) https://github.com/vim/vim/commit/aacc6afdb8cdeb2558e6942dcd65ca0079bec1ee --- src/nvim/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 4ca2e82ce1..ace56a375f 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -321,7 +321,7 @@ let s:filename_checks = { \ 'openroad': ['file.or'], \ 'ora': ['file.ora'], \ 'pamconf': ['/etc/pam.conf'], - \ 'pamenv': ['/home/user/.pam_environment'], + \ 'pamenv': ['/etc/security/pam_env.conf', '/home/user/.pam_environment'], \ 'papp': ['file.papp', 'file.pxml', 'file.pxsl'], \ 'pascal': ['file.pas', 'file.dpr'], \ 'passwd': ['any/etc/passwd', 'any/etc/passwd-', 'any/etc/passwd.edit', 'any/etc/shadow', 'any/etc/shadow-', 'any/etc/shadow.edit', 'any/var/backups/passwd.bak', 'any/var/backups/shadow.bak'], -- cgit