@@ -531,13 +531,8 @@ impl Editor {
531531 }
532532 }
533533 Err ( e) => {
534- // Print error message
535- if !self . silent_mode {
536- eprintln ! ( "{}" , e) ;
537- } else {
538- // In silent mode, errors still go to stderr
539- eprintln ! ( "{}" , e) ;
540- }
534+ // Errors always go to stderr
535+ eprintln ! ( "{}" , e) ;
541536 // In silent mode, errors are fatal
542537 if self . silent_mode {
543538 self . exit_code = 1 ;
@@ -2251,7 +2246,9 @@ impl Editor {
22512246 for ch in line. content ( ) . chars ( ) {
22522247 match ch {
22532248 '\t' => listed. push_str ( "^I" ) ,
2254- c if c. is_control ( ) => {
2249+ c if c. is_ascii_control ( ) => {
2250+ // Only convert ASCII control characters (0x00-0x1F)
2251+ // to ^@ through ^_ notation
22552252 listed. push ( '^' ) ;
22562253 listed. push ( ( c as u8 + b'@' ) as char ) ;
22572254 }
@@ -2716,18 +2713,22 @@ impl Editor {
27162713
27172714 /// Execute :suspend or :stop command - suspend the editor.
27182715 fn execute_ex_suspend ( & mut self ) -> Result < ( ) > {
2719- // Restore terminal before suspending
2720- self . terminal . disable_raw_mode ( ) ?;
2716+ // Only restore terminal if we're in visual mode (raw mode active)
2717+ if !self . ex_standalone_mode {
2718+ self . terminal . disable_raw_mode ( ) ?;
2719+ }
27212720
27222721 // Send SIGTSTP to self
27232722 #[ cfg( unix) ]
27242723 unsafe {
27252724 libc:: raise ( libc:: SIGTSTP ) ;
27262725 }
27272726
2728- // When we resume, re-enable raw mode and redraw
2729- self . terminal . enable_raw_mode ( ) ?;
2730- self . terminal . clear_screen ( ) ?;
2727+ // Re-enable terminal handling if we were in visual mode
2728+ if !self . ex_standalone_mode {
2729+ self . terminal . enable_raw_mode ( ) ?;
2730+ self . terminal . clear_screen ( ) ?;
2731+ }
27312732
27322733 Ok ( ( ) )
27332734 }
0 commit comments