From: Daniel Hahler Date: Mon, 17 Sep 2018 11:46:46 +0000 (+0200) Subject: Fix handling of pythonBytesEscape from vim-python/python-syntax (#115) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/f196c5be1042d262206c6be67ff44eff91ebb522?ds=inline;hp=--cc;pf=etc Fix handling of pythonBytesEscape from vim-python/python-syntax (#115) Fixes https://github.com/Vimjas/vim-python-pep8-indent/issues/114 --- f196c5be1042d262206c6be67ff44eff91ebb522 diff --git a/indent/python.vim b/indent/python.vim index 8fb5a9b..55b2b1b 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -61,7 +61,7 @@ let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>' " jedi* refers to syntax definitions from jedi-vim for call signatures, which " are inserted temporarily into the buffer. let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' . - \ '=~? "\\vstring|comment|pythonbytes|jedi\\S"' + \ '=~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"' let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' . \ '=~? "\\vcomment|jedi\\S"' diff --git a/spec/indent/bytes_spec.rb b/spec/indent/bytes_spec.rb index 260a2ab..3d6744e 100644 --- a/spec/indent/bytes_spec.rb +++ b/spec/indent/bytes_spec.rb @@ -3,6 +3,7 @@ require "spec_helper" describe "handles byte strings" do before(:all) { vim.command 'syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell' + vim.command "syn match pythonBytesEscape '\\\\$'" } before(:each) { @@ -23,4 +24,13 @@ describe "handles byte strings" do vim.feedkeys 'o' indent.should == 0 end + + it "it indents backslash continuation correctly" do + vim.feedkeys 'iwith foo, \\' + vim.echo('getline(".")').should == "with foo, \\" + vim.echo('map(synstack(line("."), col(".")), "synIDattr(v:val, \"name\")")' + ).should == "['pythonBytesEscape']" + vim.feedkeys 'o' + indent.should == 8 + end end