@@ -232,29 +232,27 @@ def send_replace_changes_for_regions(view, regions, insert_string):
232232 cli .service .change (view .file_name (), location , end_location , insert_string )
233233
234234
235- def apply_edit (text , view , startl , startc , endl , endc , ntext = "" ):
235+ def apply_edit (text , view , start_line , start_offset , end_line , end_offset , new_text = "" ):
236236 """Apply a single edit specification to a view"""
237- begin = view .text_point (startl , startc )
238- end = view .text_point (endl , endc )
237+ begin = view .text_point (start_line , start_offset )
238+ end = view .text_point (end_line , end_offset )
239239 region = sublime .Region (begin , end )
240- send_replace_changes_for_regions (view , [region ], ntext )
240+ send_replace_changes_for_regions (view , [region ], new_text )
241241 # break replace into two parts to avoid selection changes
242242 if region .size () > 0 :
243243 view .erase (text , region )
244- if ( len (ntext ) > 0 ) :
245- view .insert (text , begin , ntext )
244+ if len (new_text ) > 0 :
245+ view .insert (text , begin , new_text )
246246
247247
248248def apply_formatting_changes (text , view , code_edits ):
249249 """Apply a set of edits to a view"""
250250 if code_edits :
251251 for code_edit in code_edits [::- 1 ]:
252- startlc = code_edit ["start" ]
253- (startl , startc ) = extract_line_offset (startlc )
254- endlc = code_edit ["end" ]
255- (endl , endc ) = extract_line_offset (endlc )
256- newText = code_edit ["newText" ]
257- apply_edit (text , view , startl , startc , endl , endc , ntext = newText )
252+ start_line , start_offset = extract_line_offset (code_edit ["start" ])
253+ end_line , end_offset = extract_line_offset (code_edit ["end" ])
254+ new_text = code_edit ["newText" ]
255+ apply_edit (text , view , start_line , start_offset , end_line , end_offset , new_text = new_text )
258256
259257
260258def insert_text (view , edit , loc , text ):
@@ -268,7 +266,7 @@ def insert_text(view, edit, loc, text):
268266
269267def format_range (text , view , begin , end ):
270268 """Format a range of locations in the view"""
271- if ( not is_typescript (view ) ):
269+ if not is_typescript (view ):
272270 print ("To run this command, please first assign a file name to the view" )
273271 return
274272 check_update_view (view )
@@ -307,4 +305,9 @@ def change_count(view):
307305 if IS_ST2 :
308306 return info .modify_count
309307 else :
310- return view .change_count ()
308+ return view .change_count ()
309+
310+
311+ # def get_delete_indent_space_number(view, pos):
312+ # line, offset =
313+ # tab_size = view.settings().get("tab_size", 1)
0 commit comments