aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/python.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-07-27 06:29:58 +0800
committerzeertzjq <zeertzjq@outlook.com>2026-07-27 06:31:40 +0800
commit1d36cf1dbed58db9ae72367eef07b5698584bcd5 (patch)
tree4310cd2777d7948e1c687688c4eb5c2322f00146 /runtime/autoload/python.vim
parentef93e939586300d7cd348724d16f3c507a4f13fa (diff)
downloadrneovim-1d36cf1dbed58db9ae72367eef07b5698584bcd5.tar.gz
rneovim-1d36cf1dbed58db9ae72367eef07b5698584bcd5.tar.bz2
rneovim-1d36cf1dbed58db9ae72367eef07b5698584bcd5.zip
vim-patch:f88e719: runtime(python): Fix indenting for brackets within python byte strings
Problem: s:SearchBracket()'s skip-expression matches syntax group names ending in "Comment", "Todo", or "String" to decide whether a candidate bracket is inside a string/comment and should be skipped for indentation purposes. Byte and raw-byte string literals (b"...", rb"...") are highlighted via the pythonBytes/pythonRawBytes syntax groups, which don't end in "String", so brackets inside them (e.g. b"[") were never skipped and were counted as real, unmatched brackets, producing incorrect indentation. Solution: Add "Bytes" to the indent script's existing suffix match, so pythonBytes/pythonRawBytes are recognized directly, the same way pythonString/pythonFString/pythonRawString already are. This supersedes an earlier version of this fix that renamed pythonBytes/pythonRawBytes to pythonBytesString/pythonRawBytesString in runtime/syntax/python.vim. fixes: vim/vim#20812 closes: vim/vim#20827 https://github.com/vim/vim/commit/f88e7191da1a03b2e79a2ba5fbc26f4948bcca81 Co-authored-by: qwavies <qwavsbusiness@gmail.com>
Diffstat (limited to 'runtime/autoload/python.vim')
-rw-r--r--runtime/autoload/python.vim2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/autoload/python.vim b/runtime/autoload/python.vim
index cf01198d73..8723b4ebea 100644
--- a/runtime/autoload/python.vim
+++ b/runtime/autoload/python.vim
@@ -23,7 +23,7 @@ function s:SearchBracket(fromlnum, flags)
" VIM_INDENT_TEST_TRACE_START
return searchpairpos('[[({]', '', '[])}]', a:flags,
\ {-> synstack('.', col('.'))
- \ ->indexof({_, id -> synIDattr(id, 'name') =~ '\%(Comment\|Todo\|String\)$'}) >= 0},
+ \ ->indexof({_, id -> synIDattr(id, 'name') =~ '\%(Comment\|Todo\|String\|Bytes\)$'}) >= 0},
\ [0, a:fromlnum - s:maxoff]->max(), g:python_indent.searchpair_timeout)
" VIM_INDENT_TEST_TRACE_END python#s:SearchBracket
endfunction