updated for version 7.0162
diff --git a/src/ex_getln.c b/src/ex_getln.c
index f92140a..b355257 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -301,6 +301,10 @@
     ui_cursor_shape();		/* may show different cursor shape */
 #endif
 
+    /* When inside an autocommand for writing "exiting" may be set and
+     * terminal mode set to cooked.  Need to set raw mode here then. */
+    settmode(TMODE_RAW);
+
 #ifdef FEAT_CMDHIST
     init_history();
     hiscnt = hislen;		/* set hiscnt to impossible history value */
@@ -1050,7 +1054,7 @@
 
 	case ESC:	/* get here if p_wc != ESC or when ESC typed twice */
 	case Ctrl_C:
-		/* In exmode it doesn't make sense to return. Except when
+		/* In exmode it doesn't make sense to return.  Except when
 		 * ":normal" runs out of characters. */
 		if (exmode_active
 #ifdef FEAT_EX_EXTRA