Mercurial > vim
comparison runtime/ftplugin/jsp.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: jsp | 2 " Language: jsp |
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. |
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 = "Java Files (*.java)\t*.java\n" . | 19 let s:browsefilter = "Java Files (*.java)\t*.java\n" . |
19 \ "HTML Files (*.html, *.htm)\t*.html;*.htm\n" . | 20 \ "HTML Files (*.html, *.htm)\t*.html;*.htm\n" |
20 \ "All Files (*.*)\t*.*\n" | 21 if has("win32") |
22 let s:browsefilter .= "All Files (*.*)\t*\n" | |
23 else | |
24 let s:browsefilter .= "All Files (*)\t*\n" | |
25 endif | |
21 let s:match_words = "" | 26 let s:match_words = "" |
22 | 27 |
23 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim | 28 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim |
24 unlet b:did_ftplugin | 29 unlet b:did_ftplugin |
25 | 30 |
55 if exists("loaded_matchit") | 60 if exists("loaded_matchit") |
56 let b:match_words = s:match_words | 61 let b:match_words = s:match_words |
57 endif | 62 endif |
58 | 63 |
59 " Change the :browse e filter to primarily show JSP-related files. | 64 " Change the :browse e filter to primarily show JSP-related files. |
60 if has("gui_win32") | 65 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") |
61 let b:browsefilter="JSP Files (*.jsp)\t*.jsp\n" . s:browsefilter | 66 let b:browsefilter="JSP Files (*.jsp)\t*.jsp\n" . s:browsefilter |
62 endif | 67 endif |
63 | 68 |
64 " Undo the stuff we changed. | 69 " Undo the stuff we changed. |
65 let b:undo_ftplugin = "unlet! b:browsefilter b:match_words | " . s:undo_ftplugin | 70 let b:undo_ftplugin = "unlet! b:browsefilter b:match_words | " . s:undo_ftplugin |