Skip to content

Commit d9efc96

Browse files
authored
Handle byte strings in s:skip_special_chars (#113)
Fixes #72. Closes #71. Closes #68.
1 parent 85bbe47 commit d9efc96

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-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|jedi\\S"'
64+
\ '=~? "\\vstring|comment|pythonbytes|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

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
require "spec_helper"
2+
3+
describe "handles byte strings" do
4+
before(:all) {
5+
vim.command 'syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell'
6+
}
7+
8+
before(:each) {
9+
# clear buffer
10+
vim.normal 'gg"_dG'
11+
12+
# Insert two blank lines.
13+
# The first line is a corner case in this plugin that would shadow the
14+
# correct behaviour of other tests. Thus we explicitly jump to the first
15+
# line when we require so.
16+
vim.feedkeys 'i\<CR>\<CR>\<ESC>'
17+
}
18+
19+
it "it does not indent to bracket in byte string" do
20+
vim.feedkeys 'ireg = b"["\<Esc>'
21+
vim.echo('map(synstack(line("."), col(".")), "synIDattr(v:val, \"name\")")'
22+
).should == "['pythonBytes']"
23+
vim.feedkeys 'o'
24+
indent.should == 0
25+
end
26+
end

0 commit comments

Comments
 (0)