Compare commits

...

3 Commits

Author SHA1 Message Date
Bram Moolenaar
cd2f8f0e00 patch 8.2.3732: "set! termcap" test fails
Problem:    "set! termcap" test fails.
Solution:   Account for keys without a t_xx entry.
2021-12-03 21:18:14 +00:00
Bram Moolenaar
15a24f0898 patch 8.2.3731: "set! termcap" shows codes in one column, but not keys
Problem:    "set! termcap" shows codes in one column, but not keys.
Solution:   Also use one column for keys. (closes #9258)
2021-12-03 20:43:24 +00:00
Bram Moolenaar
800b01b0c8 patch 8.2.3730: "/etc/Muttrc.d/README" gets filetype muttrc
Problem:    "/etc/Muttrc.d/README" gets filetype muttrc.
Solution:   Move the Muttrc.d pattern down, add exception for *.rc files.
2021-12-03 19:24:41 +00:00
7 changed files with 62 additions and 18 deletions

View File

@@ -1123,14 +1123,15 @@ au BufNewFile,BufRead *.msql setf msql
" Mysql
au BufNewFile,BufRead *.mysql setf mysql
" Mutt setup files (must be before catch *.rc)
au BufNewFile,BufRead */etc/Muttrc.d/* call s:StarSetf('muttrc')
" Tcl Shell RC file
au BufNewFile,BufRead tclsh.rc setf tcl
" M$ Resource files
au BufNewFile,BufRead *.rc,*.rch setf rc
" /etc/Muttrc.d/file.rc is muttrc
au BufNewFile,BufRead *.rc,*.rch
\ if expand("<afile>") !~ "/etc/Muttrc.d/" |
\ setf rc |
\ endif
" MuPAD source
au BufRead,BufNewFile *.mu setf mupad
@@ -2286,6 +2287,9 @@ au BufNewFile,BufRead */etc/modutils/*
\|endif
au BufNewFile,BufRead */etc/modprobe.* call s:StarSetf('modconf')
" Mutt setup files (must be before catch *.rc)
au BufNewFile,BufRead */etc/Muttrc.d/* call s:StarSetf('muttrc')
" Mutt setup file
au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc')
au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc* call s:StarSetf('muttrc')

View File

@@ -1223,6 +1223,7 @@ ex_set(exarg_T *eap)
* OPT_MODELINE for a modeline
* OPT_WINONLY to only set window-local options
* OPT_NOWIN to skip setting window-local options
* OPT_ONECOLUMN do not use multiple columns
*
* returns FAIL if an error is detected, OK otherwise
*/
@@ -1290,7 +1291,7 @@ do_set(
else if (STRNCMP(arg, "termcap", 7) == 0 && !(opt_flags & OPT_MODELINE))
{
showoptions(2, opt_flags);
show_termcodes();
show_termcodes(opt_flags);
did_show = TRUE;
arg += 7;
}

View File

@@ -80,7 +80,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen);
void term_get_fg_color(char_u *r, char_u *g, char_u *b);
void term_get_bg_color(char_u *r, char_u *g, char_u *b);
char_u *replace_termcodes(char_u *from, char_u **bufp, int flags, int *did_simplify);
void show_termcodes(void);
void show_termcodes(int flags);
int show_one_termcode(char_u *name, char_u *code, int printit);
void update_tcap(int attr);
void swap_tcap(void);

View File

@@ -6217,9 +6217,10 @@ gather_termleader(void)
/*
* Show all termcodes (for ":set termcap")
* This code looks a lot like showoptions(), but is different.
* "flags" can have OPT_ONECOLUMN.
*/
void
show_termcodes(void)
show_termcodes(int flags)
{
int col;
int *items;
@@ -6244,12 +6245,13 @@ show_termcodes(void)
msg_puts_title(_("\n--- Terminal keys ---"));
/*
* do the loop two times:
* Do the loop three times:
* 1. display the short items (non-strings and short strings)
* 2. display the medium items (medium length strings)
* 3. display the long items (remaining strings)
* When "flags" has OPT_ONECOLUMN do everything in 3.
*/
for (run = 1; run <= 3 && !got_int; ++run)
for (run = (flags & OPT_ONECOLUMN) ? 3 : 1; run <= 3 && !got_int; ++run)
{
/*
* collect the items in items[]
@@ -6259,9 +6261,10 @@ show_termcodes(void)
{
len = show_one_termcode(termcodes[i].name,
termcodes[i].code, FALSE);
if (len <= INC3 - GAP ? run == 1
if ((flags & OPT_ONECOLUMN) ||
(len <= INC3 - GAP ? run == 1
: len <= INC2 - GAP ? run == 2
: run == 3)
: run == 3))
items[item_count++] = i;
}

View File

@@ -340,7 +340,7 @@ let s:filename_checks = {
\ 'msql': ['file.msql'],
\ 'mupad': ['file.mu'],
\ 'mush': ['file.mush'],
\ 'muttrc': ['Muttngrc', 'Muttrc', '.muttngrc', '.muttngrc-file', '.muttrc', '.muttrc-file', '/.mutt/muttngrc', '/.mutt/muttngrc-file', '/.mutt/muttrc', '/.mutt/muttrc-file', '/.muttng/muttngrc', '/.muttng/muttngrc-file', '/.muttng/muttrc', '/.muttng/muttrc-file', '/etc/Muttrc.d/file', 'Muttngrc-file', 'Muttrc-file', 'any/.mutt/muttngrc', 'any/.mutt/muttngrc-file', 'any/.mutt/muttrc', 'any/.mutt/muttrc-file', 'any/.muttng/muttngrc', 'any/.muttng/muttngrc-file', 'any/.muttng/muttrc', 'any/.muttng/muttrc-file', 'any/etc/Muttrc.d/file', 'muttngrc', 'muttngrc-file', 'muttrc', 'muttrc-file'],
\ 'muttrc': ['Muttngrc', 'Muttrc', '.muttngrc', '.muttngrc-file', '.muttrc', '.muttrc-file', '/.mutt/muttngrc', '/.mutt/muttngrc-file', '/.mutt/muttrc', '/.mutt/muttrc-file', '/.muttng/muttngrc', '/.muttng/muttngrc-file', '/.muttng/muttrc', '/.muttng/muttrc-file', '/etc/Muttrc.d/file', '/etc/Muttrc.d/file.rc', 'Muttngrc-file', 'Muttrc-file', 'any/.mutt/muttngrc', 'any/.mutt/muttngrc-file', 'any/.mutt/muttrc', 'any/.mutt/muttrc-file', 'any/.muttng/muttngrc', 'any/.muttng/muttngrc-file', 'any/.muttng/muttrc', 'any/.muttng/muttrc-file', 'any/etc/Muttrc.d/file', 'muttngrc', 'muttngrc-file', 'muttrc', 'muttrc-file'],
\ 'mysql': ['file.mysql'],
\ 'n1ql': ['file.n1ql', 'file.nql'],
\ 'named': ['namedfile.conf', 'rndcfile.conf', 'named-file.conf', 'named.conf', 'rndc-file.conf', 'rndc-file.key', 'rndc.conf', 'rndc.key'],
@@ -503,7 +503,7 @@ let s:filename_checks = {
\ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl'],
\ 'texinfo': ['file.texinfo', 'file.texi', 'file.txi'],
\ 'texmf': ['texmf.cnf'],
\ 'text': ['file.text', 'README', 'LICENSE', 'COPYING', 'AUTHORS', '/usr/share/doc/bash-completion/AUTHORS', '/etc/apt/apt.conf.d/README'],
\ 'text': ['file.text', 'README', 'LICENSE', 'COPYING', 'AUTHORS', '/usr/share/doc/bash-completion/AUTHORS', '/etc/apt/apt.conf.d/README', '/etc/Muttrc.d/README'],
\ 'tf': ['file.tf', '.tfrc', 'tfrc'],
\ 'tidy': ['.tidyrc', 'tidyrc', 'tidy.conf'],
\ 'tilde': ['file.t.html'],

View File

@@ -1,5 +1,7 @@
" Tests for the :set command
source check.vim
function Test_set_backslash()
let isk_save = &isk
@@ -45,4 +47,32 @@ func Test_set_no_arg()
setglobal textwidth&
endfunc
func Test_set_termcap()
CheckNotGui
let lines = split(execute('set termcap'), "\n")
call assert_match('--- Terminal codes ---', lines[0])
" four columns
call assert_match('t_..=.*t_..=.*t_..=.*t_..=', lines[1])
for keys_idx in range(len(lines))
if lines[keys_idx] =~ '--- Terminal keys ---'
break
endif
endfor
call assert_true(keys_idx < len(lines))
" three columns
call assert_match('<[^>]*> .*<[^>]*> .*<[^>]*> ', lines[keys_idx + 1])
let more_lines = split(execute('set! termcap'), "\n")
for i in range(len(more_lines))
if more_lines[i] =~ '--- Terminal keys ---'
break
endif
endfor
call assert_true(i < len(more_lines))
call assert_true(i > keys_idx)
call assert_true(len(more_lines) - i > len(lines) - keys_idx)
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -753,6 +753,12 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3732,
/**/
3731,
/**/
3730,
/**/
3729,
/**/