diff --git a/src/proto.h b/src/proto.h
index 636793eaca4916225301c82aa96ada48a303cea3..96da1ec78885dff0f871402ca73e0f41354a6712 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -776,7 +776,7 @@ long get_unicode_kbinput(WINDOW *win, int kbinput);
 int get_control_kbinput(int kbinput);
 void unparse_kbinput(char *output, size_t output_len);
 int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
-int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
+int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
 #ifndef DISABLE_MOUSE
 int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
 #endif
diff --git a/src/winio.c b/src/winio.c
index 2e137fc4d48388bf4086f2a54a96884a99a8ba4e..43a4f93a90723b31c779dde73acd0b9f7fd6418f 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1311,13 +1311,13 @@ int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
     return retval;
 }
 
-/* Read in a stream of all available characters, and return the length
- * of the string in kbinput_len.  Translate the first few characters of
- * the input into the corresponding multibyte value if possible.  After
- * that, leave the input as-is. */
-int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
+/* Read in one control character (or an iTerm double Escape), or convert a
+ * series of six digits into a Unicode codepoint.  Return in count either 1
+ * (for a control character or the first byte of a multibyte sequence), or 2
+ * (for an iTerm double Escape). */
+int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
 {
-    int *kbinput, *retval;
+    int *kbinput;
 
     /* Read in the first code. */
     while ((kbinput = get_input(win, 1)) == NULL)
@@ -1326,8 +1326,8 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
 #ifndef NANO_TINY
     /* When the window was resized, abort and return nothing. */
     if (*kbinput == KEY_WINCH) {
-	*kbinput_len = 0;
 	free(kbinput);
+	*count = 0;
 	return NULL;
     }
 #endif
@@ -1369,18 +1369,19 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
 	}
     } else
 #endif /* ENABLE_UTF8 */
-
 	/* Put back the first code. */
 	unget_input(kbinput, 1);
 
     free(kbinput);
 
-    /* Get the complete sequence, and save the characters in it as the
-     * result. */
-    *kbinput_len = key_buffer_len;
-    retval = get_input(NULL, *kbinput_len);
+    *count = 1;
 
-    return retval;
+    /* If this is an iTerm double escape, take both Escapes. */
+    if (key_buffer_len > 3 && *key_buffer == ESC_CODE &&
+		key_buffer[1] == ESC_CODE && key_buffer[2] == '[')
+	*count = 2;
+
+    return get_input(NULL, *count);
 }
 
 #ifndef DISABLE_MOUSE