diff --git a/src/text.c b/src/text.c
index 28c26d59008f5b5b1f78a35aafe932dbb25fff21..4de48bdecad2eb216ed20d0a548a596a38e2083f 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1619,8 +1619,9 @@ bool do_wrap(filestruct *line)
 	/* When requested, snip trailing blanks off the wrapped line. */
 	if (ISSET(TRIM_BLANKS)) {
 		size_t cur_x = move_mbleft(line->data, wrap_loc);
+		size_t typed_x = move_mbleft(line->data, old_x);
 
-		while (is_blank_mbchar(line->data + cur_x)) {
+		while (is_blank_mbchar(line->data + cur_x) && cur_x != typed_x) {
 			openfile->current_x = cur_x;
 			do_delete();
 			cur_x = move_mbleft(line->data, cur_x);