edit.c.diff   [plain text]


Index: src/edit.c
===================================================================
--- src/edit.c	(revision 57762)
+++ src/edit.c	(working copy)
@@ -321,7 +321,7 @@
     int		inserted_space = FALSE;     /* just inserted a space */
     int		replaceState = REPLACE;
     int		nomove = FALSE;		    /* don't move cursor on return */
-
+    int		orig_count = count;	    /* for autoindent calculation */
     /* Remember whether editing was restarted after CTRL-O. */
     did_restart_edit = restart_edit;
 
@@ -416,7 +416,7 @@
 	    AppendCharToRedobuff(cmdchar);
 	    if (cmdchar == 'g')		    /* "gI" command */
 		AppendCharToRedobuff('I');
-	    else if (cmdchar == 'r')	    /* "r<CR>" command */
+	    else if (cmdchar == 'r' && !Unix2003_compat)	    /* "r<CR>" command */
 		count = 1;		    /* insert only one <CR> */
 	}
     }
@@ -1286,6 +1286,8 @@
 		goto doESCkey;
 	    }
 #endif
+	    if (Unix2003_compat && (cmdchar == 'r') && (orig_count > 1))
+		did_ai = TRUE;
 	    if (ins_eol(c) && !p_im)
 		goto doESCkey;	    /* out of memory */
 	    auto_format(FALSE, FALSE);