Skip to content

Commit f196c5b

Browse files
authored
Fix handling of pythonBytesEscape from vim-python/python-syntax (Vimjas#115)
Fixes Vimjas#114
1 parent d9efc96 commit f196c5b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

indent/python.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
6161
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
6262
" are inserted temporarily into the buffer.
6363
let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
64-
\ '=~? "\\vstring|comment|pythonbytes|jedi\\S"'
64+
\ '=~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"'
6565

6666
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
6767
\ '=~? "\\vcomment|jedi\\S"'

spec/indent/bytes_spec.rb

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
describe "handles byte strings" do
44
before(:all) {
55
vim.command 'syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell'
6+
vim.command "syn match pythonBytesEscape '\\\\$'"
67
}
78

89
before(:each) {
@@ -23,4 +24,13 @@
2324
vim.feedkeys 'o'
2425
indent.should == 0
2526
end
27+
28+
it "it indents backslash continuation correctly" do
29+
vim.feedkeys 'iwith foo, \<Bslash>\<Esc>'
30+
vim.echo('getline(".")').should == "with foo, \\"
31+
vim.echo('map(synstack(line("."), col(".")), "synIDattr(v:val, \"name\")")'
32+
).should == "['pythonBytesEscape']"
33+
vim.feedkeys 'o'
34+
indent.should == 8
35+
end
2636
end

0 commit comments

Comments
 (0)