Merge pull request #12259 from janlazo/vim-8.1.1186

This commit is contained in:
James McCoy 2020-05-15 10:36:32 -04:00 committed by GitHub
commit e2a33a6622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 32 additions and 22 deletions

View File

@ -1129,6 +1129,9 @@ au BufNewFile,BufRead pf.conf setf pf
" Pam conf " Pam conf
au BufNewFile,BufRead */etc/pam.conf setf pamconf au BufNewFile,BufRead */etc/pam.conf setf pamconf
" Pam environment
au BufNewFile,BufRead pam_env.conf,.pam_environment setf pamenv
" PApp " PApp
au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp

View File

@ -10,6 +10,7 @@ filetype indent on
syn on syn on
set nowrapscan set nowrapscan
set report=9999 set report=9999
set modeline
au! SwapExists * call HandleSwapExists() au! SwapExists * call HandleSwapExists()
func HandleSwapExists() func HandleSwapExists()

View File

@ -1330,12 +1330,13 @@ struct window_S {
uint32_t w_p_fde_flags; // flags for 'foldexpr' uint32_t w_p_fde_flags; // flags for 'foldexpr'
uint32_t w_p_fdt_flags; // flags for 'foldtext' uint32_t w_p_fdt_flags; // flags for 'foldtext'
int *w_p_cc_cols; // array of columns to highlight or NULL 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_siso; // 'sidescrolloff' local value
long w_p_so; // 'scrolloff' 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 // transform a pointer to a "onebuf" option into a "allbuf" option
#define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T)) #define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T))

View File

@ -6393,20 +6393,14 @@ static void f_readdir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
os_closedir(&dir); os_closedir(&dir);
} }
rettv->vval.v_list = tv_list_alloc(kListLenShouldKnow); if (rettv->vval.v_list != NULL && ga.ga_len > 0) {
if (rettv->vval.v_list != NULL) {
tv_list_ref(rettv->vval.v_list);
sort_strings((char_u **)ga.ga_data, ga.ga_len); sort_strings((char_u **)ga.ga_data, ga.ga_len);
for (int i = 0; i < ga.ga_len; i++) { for (int i = 0; i < ga.ga_len; i++) {
path = ((const char **)ga.ga_data)[i]; path = ((const char **)ga.ga_data)[i];
tv_list_append_string(rettv->vval.v_list, path, -1); tv_list_append_string(rettv->vval.v_list, path, -1);
} }
} }
for (int i = 0; i < ga.ga_len; i++) { ga_clear_strings(&ga);
xfree(((uint8_t **)ga.ga_data)[i]);
}
ga_clear(&ga);
} }
/* /*

View File

@ -398,10 +398,10 @@ int get_breakindent_win(win_T *wp, const char_u *line)
prev_tick = buf_get_changedtick(wp->w_buffer); 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); 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 // indent minus the length of the showbreak string
if (wp->w_p_brisbr) { if (wp->w_briopt_sbr) {
bri -= vim_strsize(p_sbr); bri -= vim_strsize(p_sbr);
} }
// Add offset for number column, if 'n' is in 'cpoptions' // 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 // never indent past left window margin
if (bri < 0) { if (bri < 0) {
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, // always leave at least bri_min characters on the left,
// if text width is sufficient // if text width is sufficient
bri = (eff_wwidth - wp->w_p_brimin < 0) bri = (eff_wwidth - wp->w_briopt_min < 0)
? 0 : eff_wwidth - wp->w_p_brimin; ? 0 : eff_wwidth - wp->w_briopt_min;
} }
return bri; return bri;

View File

@ -7229,9 +7229,9 @@ static bool briopt_check(win_T *wp)
} }
} }
wp->w_p_brishift = bri_shift; wp->w_briopt_shift = bri_shift;
wp->w_p_brimin = bri_min; wp->w_briopt_min = bri_min;
wp->w_p_brisbr = bri_sbr; wp->w_briopt_sbr = bri_sbr;
return true; return true;
} }

View File

@ -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) { && n_extra == 0 && *p_sbr != NUL) {
// draw indent after showbreak value // draw indent after showbreak value
draw_state = WL_BRI; 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 // after the showbreak, draw the breakindent
draw_state = WL_BRI - 1; draw_state = WL_BRI - 1;
} }
@ -2994,7 +2994,7 @@ win_line (
c_final = NUL; c_final = NUL;
n_extra = n_extra =
get_breakindent_win(wp, ml_get_buf(wp->w_buffer, lnum, false)); 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_briopt_sbr) {
need_showbreak = false; need_showbreak = false;
} }
// Correct end of highlighted area for 'breakindent', // Correct end of highlighted area for 'breakindent',

View File

@ -361,5 +361,15 @@ func Test_breakindent19_sbr_nextpage()
\ "> aaaaaaaaaaaaaaaaaa", \ "> aaaaaaaaaaaaaaaaaa",
\ ] \ ]
call s:compare_lines(expect, lines) 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&') call s:close_windows('set breakindent& briopt& sbr&')
endfunc endfunc

View File

@ -321,6 +321,7 @@ let s:filename_checks = {
\ 'openroad': ['file.or'], \ 'openroad': ['file.or'],
\ 'ora': ['file.ora'], \ 'ora': ['file.ora'],
\ 'pamconf': ['/etc/pam.conf'], \ 'pamconf': ['/etc/pam.conf'],
\ 'pamenv': ['/etc/security/pam_env.conf', '/home/user/.pam_environment'],
\ 'papp': ['file.papp', 'file.pxml', 'file.pxsl'], \ 'papp': ['file.papp', 'file.pxml', 'file.pxsl'],
\ 'pascal': ['file.pas', 'file.dpr'], \ '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'], \ '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'],