diff --git a/main/asterisk.c b/main/asterisk.c
index 2b3832a4d17711e31b2b1ce1bd3b12462907400a..ccacc6aa6d1b0e78f34db1c17ac6f8cc603ca78f 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -2235,10 +2235,10 @@ static char *cli_prompt(EditLine *editline)
 					t--;
 					break;
 				}
-				t++;
 			} else {
 				ast_str_append(&prompt, 0, "%c", *t);
 			}
+			t++;
 		}
 		if (color_used) {
 			/* Force colors back to normal at end */