Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10068,6 +10068,13 @@ def handle_enter(event):
return

# --- Normal input routing ---
# Defer during rapid text input (paste without bracketed-paste support).
# When newlines arrive as individual Enter events, _on_text_changed fires
# for each character. If the last text change was < 50 ms ago, text is
# still arriving — skip submission and let the buffer accumulate.
if _last_text_change[0] and (time.monotonic() - _last_text_change[0]) < 0.05:
return

text = event.app.current_buffer.text.strip()
has_images = bool(self._attached_images)
if text or has_images:
Expand Down Expand Up @@ -10717,6 +10724,7 @@ def _input_height():
_prev_newline_count = [0]
_paste_just_collapsed = [False]
self._skip_paste_collapse = False
_last_text_change = [None]

def _on_text_changed(buf):
"""Detect large pastes and collapse them to a file reference.
Expand All @@ -10733,6 +10741,7 @@ def _on_text_changed(buf):
still batch newlines. Alt+Enter only adds 1 newline per
event so it never triggers this.
"""
_last_text_change[0] = time.monotonic()
text = _strip_leaked_bracketed_paste_wrappers(buf.text)
text, _had_mouse_reports = _strip_leaked_terminal_responses_with_meta(text)
if _had_mouse_reports:
Expand Down