File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -243,17 +243,16 @@ function! s:indent_like_previous_line(lnum)
243243 let ignore_last_char = eval (s: skip_special_chars )
244244
245245 " Search for final colon that is not inside something to be ignored.
246- while search ( ' : ' , ' bcW ' , lnum)
246+ while 1
247247 let curpos = getpos (" ." )[2 ]
248248 if curpos == 1 | break | endif
249- if eval (s: skip_special_chars )
249+ if eval (s: skip_special_chars ) || text[curpos - 1 ] = ~ ' \s '
250250 normal ! h
251251 continue
252- endif
253- if ! s: match_expr_on_line (s: skip_special_chars , lnum, curpos)
252+ elseif text[curpos- 1 ] == ' :'
254253 return base + s: sw ()
255254 endif
256- normal ! h
255+ break
257256 endwhile
258257
259258 if text = ~ ' \\$' && ! ignore_last_char
Original file line number Diff line number Diff line change 153153 end
154154 end
155155
156+ describe "when the previous line has a list slice" do
157+ it "does not indent" do
158+ vim . feedkeys 'ib = a[2:]\<CR>'
159+ indent . should == 0
160+ proposed_indent . should == 0
161+ end
162+ end
163+
156164 describe "when after an '(' that is followed by an unfinished string" do
157165 before { vim . feedkeys 'itest("""' }
158166
You can’t perform that action at this time.
0 commit comments