diff --git a/src/text.c b/src/text.c
index 409479fe24f10b2b8088055dc25685339a4b209c..440ebb89d08a99a0ab9e7aa8200e273b43c9f8b7 100644
--- a/src/text.c
+++ b/src/text.c
@@ -316,10 +316,12 @@ void do_indent_marked(ssize_t cols)
 	    openfile->totsize += line_indent_len;
 
 	    /* Keep track of the change in the current line. */
-	    if (f == openfile->mark_begin)
+	    if (f == openfile->mark_begin && openfile->mark_begin_x >=
+		indent_len)
 		openfile->mark_begin_x += line_indent_len;
 
-	    if (f == openfile->current)
+	    if (f == openfile->current && openfile->current_x >=
+		indent_len)
 		openfile->current_x += line_indent_len;
 
 	    /* If the NO_NEWLINES flag isn't set, and this is the