@@ -21,6 +21,7 @@ function! elixir#indent#indent(lnum)
2121
2222 let  handlers =  [
2323 \' top_of_file',
24+  \' starts_with_string_continuation',
2425 \' following_trailing_binary_operator',
2526 \' starts_with_pipe',
2627 \' starts_with_binary_operator',
@@ -31,9 +32,14 @@ function! elixir#indent#indent(lnum)
3132 \] 
3233 for  handler in  handlers
3334 call  s: debug (' testing handler elixir#indent#handle_'  .handler)
34-  let  context =  {' lnum'  : lnum, ' text'  : text, ' prev_nb_lnum'  : prev_nb_lnum, ' prev_nb_text'  : prev_nb_text}
35+  let  context =  {' lnum'  : lnum, ' text'  : text, ' first_nb_char_idx ' :  match (text,  ' \w ' ),  ' prev_nb_lnum'  : prev_nb_lnum, ' prev_nb_text'  : prev_nb_text}
3536 let  indent  =  function (' elixir#indent#handle_'  .handler)(context)
36-  if  indent  !=  -1 
37+  if  indent  ==  -2 
38+  "  Keep indent the same 
39+  call  s: debug (' line '  .lnum.' : elixir#indent#handle_'  .handler.'  returned -2; returning indent of -1'  )
40+  call  cursor (curs_lnum, curs_col)
41+  return  -1 
42+  elseif  indent  !=  -1 
3743 call  s: debug (' line '  .lnum.' : elixir#indent#handle_'  .handler.'  returned '  .indent )
3844 call  cursor (curs_lnum, curs_col)
3945 return  indent 
@@ -98,7 +104,11 @@ endfunction
98104"  Returns 0 or 1 based on whether or not the given line number and column
99105"  number pair is a string or comment
100106function !  s: is_string_or_comment (line , col )
101-  return  synIDattr (synID (a: line , a: col , 1 ), " name"  ) = ~ ' \%(String\|Comment\)' 
107+  return  s: syntax_name (a: line , a: col ) = ~ ' \%(String\|Comment\)' 
108+ endfunction 
109+ 
110+ function !  s: syntax_name (line , col )
111+  return  synIDattr (synID (a: line , a: col , 1 ), " name"  )
102112endfunction 
103113
104114"  Skip expression for searchpair. Returns 0 or 1 based on whether the value
@@ -154,6 +164,14 @@ function! elixir#indent#handle_top_of_file(context)
154164 end 
155165endfunction 
156166
167+ function !  elixir#indent#handle_starts_with_string_continuation (context)
168+  if  s: syntax_name (a: context .lnum, a: context .first_nb_char_idx) = ~ ' \(String\|Comment\)$' 
169+  return  -2 
170+  else 
171+  return  -1 
172+  end 
173+ endfunction 
174+ 
157175function !  elixir#indent#handle_follow_prev_nb (context)
158176 return  s: get_base_indent (a: context .prev_nb_lnum, a: context .prev_nb_text)
159177endfunction 
0 commit comments