diff --git a/src/text.c b/src/text.c
index 8b49788217636819e6b8b8b81a51e05556b7ebb4..a01bcc866b68711e3696e68eaf62d415ed9c2028 100644
--- a/src/text.c
+++ b/src/text.c
@@ -343,6 +343,7 @@ void do_indent(void)
 
     set_modified();
     refresh_needed = TRUE;
+    shift_held = TRUE;
 }
 
 /* Return the number of bytes of whitespace at the start of the given text,
@@ -439,6 +440,7 @@ void do_unindent(void)
 
     set_modified();
     refresh_needed = TRUE;
+    shift_held = TRUE;
 }
 
 /* Perform an undo or redo for an indent or unindent action. */
@@ -550,6 +552,7 @@ void do_comment(void)
 
     set_modified();
     refresh_needed = TRUE;
+    shift_held = TRUE;
 }
 
 /* Test whether the given line can be uncommented, or add or remove a comment,