Followup to #28515:
Rename the static os_homedir() to os_uv_homedir() to emphasize that it
is a wrapper around a libuv function.
Add the function os_get_homedir() to os/env.c to return the cached
homedir value as a const. Must be called after homedir is initialized or
it fails.
The difference between this function and the static os_uv_homedir() is
that the latter gets the homedir from libuv and is used to initialize
homedir in init_homedir(), while os_get_homedir() just returns homedir
as a const if it's initialized and is public.
Use the os_get_homedir() accessor for ~/ expansion on Windows to make
the code more concise.
Add a Windows section to main_spec.lua with tests for expanding ~/ and
~\ prefixes for files passed in on the command-line.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Do the expansion right after setting the expand context, so that the
length of the completion prefix can be set, but don't do that directly
in set_one_cmd_context(), as that's also called by getcmdcompltype().
Problem: matched text is highlighted case-sensitively
Solution: use MB_STRNICMP, update highlighting when the base changes
(glepnir)
fixes: vim/vim#15021closes: vim/vim#15023f189138b39
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: Matched text isn't highlighted in cmdline pum.
Solution: Use cmdline completion pattern in cmdline mode.
(zeertzjq)
closes: vim/vim#15029d8c9340fc6
Cherry-pick syntax.txt change from runtime update.
Problem: Wrong matched text highlighted in pum with 'rightleft'.
Solution: Match using the original text instead of the reversed text.
(zeertzjq)
closes: vim/vim#1502063901e8963
The value of g:javac_makeprg_params, if set, is added to the value of
'makeprg' as an option string.
closes: vim/vim#149990ddab582fa
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: A custom 'statuscolumn' needs to check a bunch of options and
placed signs to replicate the default number column.
Solution: Rework %l item to include the necessary logic to mimic the
default number column. Remove now redundant %r item.
Also:
- Restore the capability to mark as an error braces nested
in parens with g:javaInParen.
- Try not to fold top-level-type bodies. (Defining multiple
package-private top level types in a single source file is
not recommended as it can impose order among compilation
units; so it is assumed that only one such top level type
is usually defined.)
- Compose ‘method header’ highlighting and block braces
folding.
- Do not highlight block braces whenever ‘method header’
highlighting is requested.
This bundling of ‘method headers’ and block braces for
highlighting can be traced back to Vim v5.0; however, no
comment or documentation entry conveys any justification.
For example, it is hard to discover the connection between
block braces for "while", "if", etc., statements and method
body block braces. The former behaviour can be attained in,
e.g. ~/.vim/after/syntax/java.vim:
------------------------------------------------------------
if exists("g:java_highlight_functions")
syn clear javaBlock javaInParen
syn match javaBlockOther "[{}]"
syn region javaBlock transparent matchgroup=javaBlockStart
\ start="\%(^\|^\S[^:]\+\)\@120<!{" end="}" fold
hi def link javaBlockStart javaFuncDef
hi def link javaBlockOther javaBlockStart
if exists("g:java_mark_braces_in_parens_as_errors")
syn match javaInParen contained "[{}]"
endif
endif
------------------------------------------------------------
Note: Read ‘a method header omitting a _throws_ clause’ for
every ‘method header’ appellation used above.
371bab0594
Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
Problem: Vim-script files may not be recognised
Solution: Add shebang line detection (Doug Kearns)
closes: vim/vim#150120d4d23dac0
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: Test for patch 9.1.0489 doesn't fail without the fix.
Solution: Use "!" flag of feedkeys() so that ex_normal_busy is not set
and ins_compl_check_keys() is not skipped (zeertzjq).
closes: vim/vim#15018acc8746941
Problem: default completion may break with fuzzy
Solution: check that completion_match_array is not null
(glepnir)
closes: vim/vim#15010aced8c2f4f
Co-authored-by: glepnir <glephunter@gmail.com>
This was wrongly included as of patch 1c6734291295bf8aa39577840b40bb
because apparently I messed up the use of git apply :/
52f2ff0363
Co-authored-by: Christian Brabandt <cb@256bit.org>
This change does the following 3 things:
1) non need to quote the file to be extracted
The zipfile plugin used to quote and fnameescape() the path to the
file to be extracted. However testing with unzip showed, that while this
works on Linux on Windows you shall not escape the blanks in filenames.
As long as the pathname is properly quoted, this words on Linux and
Windows.
2) reset shellslash (MS-Windows only)
When shellslash is set, filenames to the zip archive will be forward
quoted. However since the filename is eventually handed over to the
unzip command, we need to make sure to use native paths so that the
command will understand what file to open. Therefore, if shellslash is
set (and the shell is cmd.exe), replace any forward slashes by the
expected backslashes
3) style:
Use tabs for the Header, remove a few comments in the s:Escape() and
zip#read() functions
fixes: vim/vim#149981c67342912
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Cmdline pum doesn't work properly with 'rightleft'.
Solution: Don't use curwin->w_p_rl in cmdline mode in pum_redraw(). Use
a static variable since pum_may_redraw() may be called in any
mode. Also correct position of other popups with 'rightleft'.
(zeertzjq)
closes: vim/vim#15005883018feff
Problem: Wrong padding for pum "kind" with 'rightleft'.
Solution: Fix off-by-one error (zeertzjq).
The screen_fill() above is end-exclusive, and
- With 'rightleft' it fills `pum_col - pum_base_width - n + 1` to `col`,
so the next `col` should be `pum_col - pum_base_width - n`.
- With 'norightleft' it fills `col` to `pum_col - pum_base_width + n - 1`,
so the next `col` should be `pum_col - pum_base_width + n`.
closes: vim/vim#15004a2324373eb
Match shebang lines in Vim9 and legacy script.
Mark these as an error if they appear anywhere other than the first line
of a legacy-script file. In Vim9 script these match as normal line
comments rather than an error.
ae321b51f7
Co-authored-by: dkearns <dougkearns@gmail.com>
Problem:
When 'ignorecase' is set, the default keymap Q and Q would exit visual
mode.
This issue was raised in #28287 and a fix was applied in #28289.
However, `==` operator is subject to user `ignorecase` setting.
Solution:
Switching to `==#` operator would guarantee case sensitive comparison
between visual mode and linewise visual mode.
Co-authored-by: Kuanju Chen <kuanju.chen@mksinst.com>
Problem: completed item not update on fuzzy completion
Solution: reset compl_shown_match when at original match position
(glepnir)
closes: vim/vim#14955f94c9c482a
Co-authored-by: glepnir <glephunter@gmail.com>
Co-authored-by: Ilia Choly <ilia.choly@gmail.com>
Co-authored-by: Jose Pedro Oliveira <jose.p.oliveira.oss@gmail.com>
Co-authored-by: Maria José Solano <majosolano99@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Match :sleep arg properly including a lone "m" with a leading count.
closes: vim/vim#15003262e25e5a1
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: Matched text shouldn't be highlighted in "kind" and "menu".
Solution: Pass hlf_T instead of the attribute. Fix indent.
(zeertzjq)
closes: vim/vim#14996afbe5359e9
Problem: fuzzy string matching executed when not needed
Solution: when no leader is available, can skip fuzzy logic, so return
early (glepnir)
closes: vim/vim#149861c29602662
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: fuzzy_match_str_with_pos() does unnecessary list operations.
Solution: Use fuzzy_match() directly (zeertzjq).
closes: vim/vim#149872f95ca9fce
N/A patch:
vim-patch:9.1.0478: potential deref of NULL pointer in fuzzy_match_str_with_pos
Problem: Cannot see matched text in popup menu
Solution: Introduce 2 new highlighting groups: PmenuMatch and
PmenuMatchSel (glepnir)
closes: vim/vim#1469440c1c3317d
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: Sorting of completeopt+=fuzzy is not stable.
Solution: Compare original indexes when scores are the same.
(zeertzjq)
closes: vim/vim#149888e56747fd2
Problem:
For snippets lsp.completion prefers the label if it is shorter than the
insertText or textEdit to support postfix completion cases but clangd
adds decoration characters to labels. E.g.: `•INT16_C(c)`
Solution:
Use parse_snippet on insertText/textEdit before checking if it is
shorter than the label.
Fixes https://github.com/neovim/neovim/issues/29301