@@ -284,15 +284,25 @@ def run(self, edit):
284284 # find the last test assertion column on the previous line
285285 details = listener .get_details_of_test_assertion_line (details .line_region .begin () - 1 )
286286 next_col = None
287- if not details .assertion_colrange :
287+ skip_whitespace = get_setting ('syntax_test.skip_whitespace' , False )
288+ if details .assertion_colrange :
289+ next_col = details .assertion_colrange [1 ]
290+ else :
288291 # the previous line wasn't a syntax test line, so instead
289- # find the first non-whitespace char on the line being tested above
290- for pos in range (details .line_region .begin (), details .line_region .end ()):
292+ # start at the first position on the line. We will then
293+ # advance to the first non-whitespace char on the line.
294+ next_col = 0
295+ skip_whitespace = True
296+
297+ # find the next non-whitespace char on the line being tested above
298+ if skip_whitespace :
299+ line_region = listener .get_details_of_line_being_tested ()[1 ]
300+ pos = line_region .begin () + next_col
301+ for pos in range (pos , line_region .end ()):
291302 if view .substr (pos ).strip () != '' :
292303 break
293304 next_col = view .rowcol (pos )[1 ]
294- else :
295- next_col = details .assertion_colrange [1 ]
305+
296306 col_diff = next_col - view .rowcol (cursor .begin ())[1 ]
297307 view .insert (edit , cursor .end (), " " * col_diff )
298308 view .run_command ('packagedev_suggest_syntax_test' )
0 commit comments