Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into tabsidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
rbtnn committed Aug 2, 2024
2 parents 900b9bf + 0aa65b4 commit 6cbf75c
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 32 deletions.
6 changes: 4 additions & 2 deletions .github/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@ runtime/ftplugin/gitconfig.vim @tpope
runtime/ftplugin/gitignore.vim @ObserverOfTime
runtime/ftplugin/gitrebase.vim @tpope
runtime/ftplugin/gitsendemail.vim @tpope
runtime/ftplugin/graphql.vim @ribru17
runtime/ftplugin/gyp.vim @ObserverOfTime
runtime/ftplugin/go.vim @dbarnett
runtime/ftplugin/goaccess.vim @meonkeys
runtime/ftplugin/gomod.vim @yu-yk
runtime/ftplugin/gprof.vim @dpelle
runtime/ftplugin/graphql.vim @ribru17
runtime/ftplugin/gyp.vim @ObserverOfTime
runtime/ftplugin/haml.vim @tpope
runtime/ftplugin/hare.vim @selenebun
runtime/ftplugin/haredoc.vim @selenebun
Expand Down Expand Up @@ -446,6 +447,7 @@ runtime/syntax/gitolite.vim @sitaramc
runtime/syntax/gitrebase.vim @tpope
runtime/syntax/glsl.vim @gpanders
runtime/syntax/go.vim @bhcleek
runtime/syntax/goaccess.vim @meonkeys
runtime/syntax/godoc.vim @dbarnett
runtime/syntax/gp.vim @KBelabas
runtime/syntax/gprof.vim @dpelle
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
env:
CC: ${{ matrix.compiler }}
GCC_VER: 13
CLANG_VER: 18
CLANG_VER: 19
TEST: test
SRCDIR: ./src
LEAK_CFLAGS: -DEXITFREE
Expand Down
33 changes: 8 additions & 25 deletions runtime/autoload/netrw.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
" 2024 Jul 22 by Vim Project: avoid endless recursion (#15318)
" 2024 Jul 23 by Vim Project: escape filename before trying to delete it (#15330)
" 2024 Jul 30 by Vim Project: handle mark-copy to same target directory (#12112)
" 2024 Aug 02 by Vim Project: honor g:netrw_alt{o,v} for :{S,H,V}explore (#15417)
" }}}
" Former Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
Expand Down Expand Up @@ -718,65 +719,48 @@ fun! netrw#Explore(indx,dosplit,style,...)
" -or- file has been modified AND file not hidden when abandoned
" -or- Texplore used
if a:dosplit || (&modified && &hidden == 0 && &bufhidden != "hide") || a:style == 6
" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified",'~'.expand("<slnum>"))
call s:SaveWinVars()
let winsz= g:netrw_winsize
if a:indx > 0
let winsz= a:indx
endif

if a:style == 0 " Explore, Sexplore
" call Decho("style=0: Explore or Sexplore",'~'.expand("<slnum>"))
let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
exe "noswapfile ".winsz."wincmd s"
" call Decho("exe noswapfile ".winsz."wincmd s",'~'.expand("<slnum>"))
exe "noswapfile ".(g:netrw_alto ? "below " : "above ").winsz."wincmd s"

elseif a:style == 1 "Explore!, Sexplore!
" call Decho("style=1: Explore! or Sexplore!",'~'.expand("<slnum>"))
elseif a:style == 1 " Explore!, Sexplore!
let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
exe "keepalt noswapfile ".winsz."wincmd v"
" call Decho("exe keepalt noswapfile ".winsz."wincmd v",'~'.expand("<slnum>"))
exe "keepalt noswapfile ".(g:netrw_altv ? "rightbelow " : "leftabove ").winsz."wincmd v"

elseif a:style == 2 " Hexplore
" call Decho("style=2: Hexplore",'~'.expand("<slnum>"))
let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
exe "keepalt noswapfile bel ".winsz."wincmd s"
" call Decho("exe keepalt noswapfile bel ".winsz."wincmd s",'~'.expand("<slnum>"))
exe "keepalt noswapfile ".(g:netrw_alto ? "below " : "above ").winsz."wincmd s"

elseif a:style == 3 " Hexplore!
" call Decho("style=3: Hexplore!",'~'.expand("<slnum>"))
let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
exe "keepalt noswapfile abo ".winsz."wincmd s"
" call Decho("exe keepalt noswapfile abo ".winsz."wincmd s",'~'.expand("<slnum>"))
exe "keepalt noswapfile ".(!g:netrw_alto ? "below " : "above ").winsz."wincmd s"

elseif a:style == 4 " Vexplore
" call Decho("style=4: Vexplore",'~'.expand("<slnum>"))
let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
exe "keepalt noswapfile lefta ".winsz."wincmd v"
" call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v",'~'.expand("<slnum>"))
exe "keepalt noswapfile ".(g:netrw_altv ? "rightbelow " : "leftabove ").winsz."wincmd v"

elseif a:style == 5 " Vexplore!
" call Decho("style=5: Vexplore!",'~'.expand("<slnum>"))
let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
exe "keepalt noswapfile rightb ".winsz."wincmd v"
" call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v",'~'.expand("<slnum>"))
exe "keepalt noswapfile ".(!g:netrw_altv ? "rightbelow " : "leftabove ").winsz."wincmd v"

elseif a:style == 6 " Texplore
call s:SaveBufVars()
" call Decho("style = 6: Texplore",'~'.expand("<slnum>"))
exe "keepalt tabnew ".fnameescape(curdir)
" call Decho("exe keepalt tabnew ".fnameescape(curdir),'~'.expand("<slnum>"))
call s:RestoreBufVars()
endif
call s:RestoreWinVars()
" else " Decho
" call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6",'~'.expand("<slnum>"))
endif
NetrwKeepj norm! 0

Expand Down Expand Up @@ -11654,7 +11638,6 @@ fun! s:StripTrailingSlash(path)
return substitute(a:path, '[/\\]$', '', 'g')
endfun


" ---------------------------------------------------------------------
" s:NetrwBadd: adds marked files to buffer list or vice versa {{{2
" cb : bl2mf=0 add marked files to buffer list
Expand Down
3 changes: 3 additions & 0 deletions runtime/filetype.vim
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,9 @@ au BufNewFile,BufRead *.go setf go
au BufNewFile,BufRead Gopkg.lock setf toml
au BufRead,BufNewFile go.work setf gowork

" GoAccess configuration
au BufNewFile,BufRead goaccess.conf setf goaccess

" GrADS scripts
au BufNewFile,BufRead *.gs setf grads

Expand Down
14 changes: 14 additions & 0 deletions runtime/ftplugin/goaccess.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
" Vim filetype plugin
" Language: GoAccess configuration
" Maintainer: Adam Monsen <[email protected]>
" Last Change: 2024 Aug 1

if exists('b:did_ftplugin')
finish
endif

let b:did_ftplugin = 1

setl comments=:# commentstring=#\ %s

let b:undo_ftplugin = 'setl com< cms<'
34 changes: 34 additions & 0 deletions runtime/syntax/goaccess.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
" Vim syntax file
" Language: GoAccess configuration
" Maintainer: Adam Monsen <[email protected]>
" Last Change: 2024 Aug 1
" Remark: see https://goaccess.io/man#configuration
"
" The GoAccess configuration file syntax is line-separated settings. Settings
" are space-separated key value pairs. Comments are any line starting with a
" hash mark.
" Example: https://github.com/allinurl/goaccess/blob/master/config/goaccess.conf
"
" This syntax definition supports todo/fixme highlighting in comments, and
" special (Keyword) highlighting if a setting's value is 'true' or 'false'.
"
" TODO: a value is required, so use extreme highlighting (e.g. bright red
" background) if a setting is missing a value.

if exists("b:current_syntax")
finish
endif

syn match goaccessSettingName '^[a-z-]\+' nextgroup=goaccessSettingValue
syn match goaccessSettingValue '\s\+.\+$' contains=goaccessKeyword
syn match goaccessComment "^#.*$" contains=goaccessTodo,@Spell
syn keyword goaccessTodo TODO FIXME contained
syn keyword goaccessKeyword true false contained

hi def link goaccessSettingName Type
hi def link goaccessSettingValue String
hi def link goaccessComment Comment
hi def link goaccessTodo Todo
hi def link goaccessKeyword Keyword

let b:current_syntax = "goaccess"
4 changes: 1 addition & 3 deletions src/ex_cmds2.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,9 @@ dialog_changed(
// restore to empty when write failed
if (empty_bufname)
{
// prevent double free
if (buf->b_sfname != buf->b_ffname)
VIM_CLEAR(buf->b_sfname);
buf->b_fname = NULL;
VIM_CLEAR(buf->b_ffname);
VIM_CLEAR(buf->b_sfname);
unchanged(buf, TRUE, FALSE);
}
}
Expand Down
27 changes: 26 additions & 1 deletion src/insexpand.c
Original file line number Diff line number Diff line change
Expand Up @@ -3552,9 +3552,34 @@ get_next_filename_completion(void)
size_t path_with_wildcard_len;
char_u *path_with_wildcard;

#ifdef BACKSLASH_IN_FILENAME
char pathsep = (curbuf->b_p_csl[0] == 's') ?
'/' : (curbuf->b_p_csl[0] == 'b') ? '\\' : PATHSEP;
#else
char pathsep = PATHSEP;
#endif

if (in_fuzzy)
{
last_sep = vim_strrchr(leader, PATHSEP);
#ifdef BACKSLASH_IN_FILENAME
if (curbuf->b_p_csl[0] == 's')
{
for (i = 0; i < leader_len; i++)
{
if (leader[i] == '\\')
leader[i] = '/';
}
}
else if (curbuf->b_p_csl[0] == 'b')
{
for (i = 0; i < leader_len; i++)
{
if (leader[i] == '/')
leader[i] = '\\';
}
}
#endif
last_sep = vim_strrchr(leader, pathsep);
if (last_sep == NULL)
{
// No path separator or separator is the last character,
Expand Down
1 change: 1 addition & 0 deletions src/testdir/test_filetype.vim
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ def s:GetFilenameChecks(): dict<list<string>>
gnash: ['gnashrc', '.gnashrc', 'gnashpluginrc', '.gnashpluginrc'],
gnuplot: ['file.gpi', '.gnuplot', 'file.gnuplot', '.gnuplot_history'],
go: ['file.go'],
goaccess: ['goaccess.conf'],
gomod: ['go.mod'],
gosum: ['go.sum', 'go.work.sum'],
gowork: ['go.work'],
Expand Down
32 changes: 32 additions & 0 deletions src/testdir/test_ins_complete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2668,6 +2668,38 @@ func Test_complete_fuzzy_match()
unlet g:word
endfunc

func Test_complete_fuzzy_with_completeslash()
CheckMSWindows

call writefile([''], 'fobar', 'D')
let orig_shellslash = &shellslash
set cpt&
new
set completeopt+=fuzzy
set noshellslash

" Test with completeslash unset
set completeslash=
call setline(1, ['.\fob'])
call feedkeys("A\<C-X>\<C-F>\<Esc>0", 'tx!')
call assert_equal('.\fobar', getline('.'))

" Test with completeslash=backslash
set completeslash=backslash
call feedkeys("S.\\fob\<C-X>\<C-F>\<Esc>0", 'tx!')
call assert_equal('.\fobar', getline('.'))

" Test with completeslash=slash
set completeslash=slash
call feedkeys("S.\\fob\<C-X>\<C-F>\<Esc>0", 'tx!')
call assert_equal('./fobar', getline('.'))

" Reset and clean up
let &shellslash = orig_shellslash
set completeslash=
%bw!
endfunc

" Check that tie breaking is stable for completeopt+=fuzzy (which should
" behave the same on different platforms).
func Test_complete_fuzzy_match_tie()
Expand Down
6 changes: 6 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,12 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
655,
/**/
654,
/**/
653,
/**/
652,
/**/
Expand Down

0 comments on commit 6cbf75c

Please sign in to comment.