@@ -122,10 +122,8 @@ def toggle_phantom(self, text, styles):
122122 { basic_styles (self .view ) }
123123 { styles }
124124 </style>"""
125- text = self .escape (text ).replace ("\n " , "<br>" )
126- # try to render newlines in multi-line strings
127- text = re .sub (r"(?<!\\)\\n" , "<br>" , text )
128- body += "<p>" + text + "</p>"
125+ for line in self .escape (text ).splitlines ():
126+ body += "<p>" + re .sub (r"(?<!\\)\\n" , "<br>" , line ) + "</p>"
129127 body += "</body>"
130128 region = self .region ()
131129 if region :
@@ -294,8 +292,7 @@ def set_selection(view, region):
294292 sel = view .sel ()
295293 sel .clear ()
296294 sel .add (region )
297- if not view .visible_region ().contains (region .a ):
298- view .show (region .a , show_surrounds = True , keep_to_left = True , animate = True )
295+ view .show (region .a , show_surrounds = True , keep_to_left = True , animate = True )
299296
300297def handle_exception (msg ):
301298 if "id" in msg and msg ["id" ] in conn .evals :
@@ -311,7 +308,7 @@ def handle_exception(msg):
311308 line = get ("line" ) - 1
312309 column = get ("column" )
313310 point = eval .view .text_point_utf16 (line , column , clamp_column = True )
314- region = sublime .Region (point , eval .view .line (point ).end () + 1 )
311+ region = sublime .Region (eval . view . line ( point ). begin () , eval .view .line (point ).end ())
315312 set_selection (eval .view , sublime .Region (point , point ))
316313 elif present ("line" ) and present ("column" ) and get ("source" ):
317314 text += " ({}:{}:{})" .format (get ("source" ), get ("line" ), get ("column" ))
@@ -641,7 +638,6 @@ def run(self, edit):
641638 view .run_command ("clojure_sublimed_toggle_trace" , {})
642639 elif eval and eval .status == "success" :
643640 if eval := conn .find_eval (view , sel ):
644- print ("eval.toggle_pprint()" , eval , sel )
645641 eval .toggle_pprint ()
646642 break
647643 else :
0 commit comments