If you habe an unmodified buffer and you read a file with
e or E command, which does not exist, the modified flag get
set by the delete_lines function, which sets the mofified_
flat to true. This prevents a new trail e/E command with
an error message "modified".

The solution is to set the modified flag immediately after
the delete_lines function.


Harry Graf

P.S. Patch as attachement
--- main_loop.bak       2022-10-01 08:40:34.740558153 +0200
+++ main_loop.c 2022-10-20 21:55:17.901387800 +0200
@@ -524,11 +524,12 @@
               fnp = get_filename( ibufpp, false );
               if( !fnp || !delete_lines( 1, last_addr(), isglobal ) ||
                   !close_sbuf() ) return ERR;
+              set_modified( false );
               if( !open_sbuf() ) return FATAL;
               if( fnp[0] && fnp[0] != '!' && !set_def_filename( fnp ) )
                 return ERR;
               if( read_file( fnp[0] ? fnp : def_filename, 0 ) < 0 ) return ERR;
-              reset_undo_state(); set_modified( false );
+              reset_undo_state(); /* set_modified( false ); */
               break;
     case 'f': if( unexpected_address( addr_cnt ) ||
                   unexpected_command_suffix( **ibufpp ) ) return ERR;

Reply via email to