diff --git a/src/nano.c b/src/nano.c
index d76edcec1201be1053bdd773e92ed8a8394f8099..ca0c56575443bc8d77214cbe4b863c3bf95210ab 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1772,8 +1772,10 @@ int do_input(bool allow_funcs)
 			}
 #endif
 #ifdef ENABLE_WRAPPING
-			/* If the cursor moved to another line, clear the prepend flag. */
-			if (openfile->current->next != was_next)
+			/* If the cursor moved to another line and this was not caused
+			 * by adding characters to the buffer, clear the prepend flag. */
+			if (openfile->current->next != was_next &&
+							s->scfunc != do_tab && s->scfunc != do_verbatim_input)
 				wrap_reset();
 #endif
 #ifdef ENABLE_COLOR