comparison runtime/ftplugin/ant.vim @ 34134:8ae680be2a51

runtime(ftplugin): Use "*" browsefilter pattern to match "All Files" Commit: https://github.com/vim/vim/commit/93197fde0f1db09b1e495cf3eb14a8f42c318b80 Author: Doug Kearns <dougkearns@gmail.com> Date: Sun Jan 14 20:59:02 2024 +0100 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files" Problem: The "*.*" browsefilter pattern only matches all files on Windows (Daryl Lee) Solution: Use "*" to filter on all platforms but keep "*.*" as the label text on Windows. (Fixes #12685, Doug Kearns) The *.* browsefilter pattern used to match "All Files" on Windows is a legacy of the DOS 8.3 filename wildcard matching algorithm. For reasons of backward compatibility this still works on Windows to match all files, even those without an extension. However, this pattern only matches filenames containing a dot on other platforms. This often makes files without an extension difficult to access from the file dialog, e.g., "Makefile" On Windows it is still standard practice to use "*.*" for the filter label so ftplugins should use "All Files (*.*)" on Windows and "All Files (*)" on other platforms. This matches Vim's default browsefilter values. This commit also normalises the browsefilter conditional test to check for the Win32 and GTK GUI features and an unset b:browsefilter. closes: #12759 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 14 Jan 2024 21:15:03 +0100
parents c968191a8557
children
comparison
equal deleted inserted replaced
34133:c6737e875c4a 34134:8ae680be2a51
1 " Vim filetype plugin file 1 " Vim filetype plugin file
2 " Language: ant 2 " Language: ant
3 " 3 "
4 " This runtime file is looking for a new maintainer. 4 " This runtime file is looking for a new maintainer.
5 " 5 "
6 " Former maintainer: Dan Sharp 6 " Former maintainer: Dan Sharp
7 " Last Changed: 20 Jan 2009 7 " Last Change: 2009 Jan 20
8 " 2024 Jan 14 by Vim Project (browsefilter)
8 9
9 if exists("b:did_ftplugin") | finish | endif 10 if exists("b:did_ftplugin") | finish | endif
10 11
11 " Make sure the continuation lines below do not cause problems in 12 " Make sure the continuation lines below do not cause problems in
12 " compatibility mode. 13 " compatibility mode.
13 let s:save_cpo = &cpo 14 let s:save_cpo = &cpo
14 set cpo-=C 15 set cpo-=C
15 16
16 " Define some defaults in case the included ftplugins don't set them. 17 " Define some defaults in case the included ftplugins don't set them.
17 let s:undo_ftplugin = "" 18 let s:undo_ftplugin = ""
18 let s:browsefilter = "XML Files (*.xml)\t*.xml\n" . 19 let s:browsefilter = "XML Files (*.xml)\t*.xml\n"
19 \ "All Files (*.*)\t*.*\n" 20 if has("win32")
21 let s:browsefilter .= "All Files (*.*)\t*\n"
22 else
23 let s:browsefilter .= "All Files (*)\t*\n"
24 endif
20 25
21 runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim 26 runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim
22 let b:did_ftplugin = 1 27 let b:did_ftplugin = 1
23 28
24 " Override our defaults if these were set by an included ftplugin. 29 " Override our defaults if these were set by an included ftplugin.
28 if exists("b:browsefilter") 33 if exists("b:browsefilter")
29 let s:browsefilter = b:browsefilter 34 let s:browsefilter = b:browsefilter
30 endif 35 endif
31 36
32 " Change the :browse e filter to primarily show Ant-related files. 37 " Change the :browse e filter to primarily show Ant-related files.
33 if has("gui_win32") 38 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
34 let b:browsefilter = "Build Files (build.xml)\tbuild.xml\n" . 39 let b:browsefilter = "Build Files (build.xml)\tbuild.xml\n" .
35 \ "Java Files (*.java)\t*.java\n" . 40 \ "Java Files (*.java)\t*.java\n" .
36 \ "Properties Files (*.prop*)\t*.prop*\n" . 41 \ "Properties Files (*.prop*)\t*.prop*\n" .
37 \ "Manifest Files (*.mf)\t*.mf\n" . 42 \ "Manifest Files (*.mf)\t*.mf\n" .
38 \ s:browsefilter 43 \ s:browsefilter