-
Notifications
You must be signed in to change notification settings - Fork 806
fix(shell): defer background auto-trigger while typing #1731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ef2fae6
e37cf0a
e785d86
50ed33d
e539647
a482667
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1250,6 +1250,8 @@ def __init__( | |||||||||||||
| self._attachment_cache = self._placeholder_manager.attachment_cache | ||||||||||||||
| self._last_tip_rotate_time: float = time.monotonic() | ||||||||||||||
| self._last_submission_was_running = False | ||||||||||||||
| self._last_input_activity_time: float = 0.0 | ||||||||||||||
| self._input_activity_event: asyncio.Event = asyncio.Event() | ||||||||||||||
| self._running_prompt_previous_mode: PromptMode | None = None | ||||||||||||||
| self._running_prompt_delegate: RunningPromptDelegate | None = None | ||||||||||||||
| self._modal_delegates: list[RunningPromptDelegate] = [] | ||||||||||||||
|
|
@@ -1516,6 +1518,8 @@ def _(event: KeyPressEvent) -> None: | |||||||||||||
| # such as when backspace is used to delete text. | ||||||||||||||
| @self._session.default_buffer.on_text_changed.add_handler | ||||||||||||||
| def _(buffer: Buffer) -> None: | ||||||||||||||
| self._last_input_activity_time = time.monotonic() | ||||||||||||||
| self._input_activity_event.set() | ||||||||||||||
| if buffer.complete_while_typing(): | ||||||||||||||
| buffer.start_completion() | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -1891,6 +1895,24 @@ async def prompt_next(self) -> UserInput: | |||||||||||||
| def last_submission_was_running(self) -> bool: | ||||||||||||||
| return getattr(self, "_last_submission_was_running", False) | ||||||||||||||
|
|
||||||||||||||
| def has_pending_input(self) -> bool: | ||||||||||||||
| return bool(self._session.default_buffer.text) | ||||||||||||||
|
|
||||||||||||||
| def had_recent_input_activity(self, *, within_s: float) -> bool: | ||||||||||||||
| if self._last_input_activity_time <= 0: | ||||||||||||||
| return False | ||||||||||||||
| return (time.monotonic() - self._last_input_activity_time) <= within_s | ||||||||||||||
|
|
||||||||||||||
| def recent_input_activity_remaining(self, *, within_s: float) -> float: | ||||||||||||||
| if self._last_input_activity_time <= 0: | ||||||||||||||
| return 0.0 | ||||||||||||||
| elapsed = time.monotonic() - self._last_input_activity_time | ||||||||||||||
| return max(0.0, within_s - elapsed) | ||||||||||||||
|
|
||||||||||||||
| async def wait_for_input_activity(self) -> None: | ||||||||||||||
| await self._input_activity_event.wait() | ||||||||||||||
| self._input_activity_event.clear() | ||||||||||||||
|
Comment on lines
+1913
to
+1914
|
||||||||||||||
| await self._input_activity_event.wait() | |
| self._input_activity_event.clear() | |
| # Clear any previous activity signal before waiting, so that | |
| # new activity that occurs after this point will reliably wake us. | |
| self._input_activity_event.clear() | |
| await self._input_activity_event.wait() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Duplicate Grep changelog entry in English docs
The PR adds three new entries to the English changelog at lines 7-9, but line 9 is an exact duplicate of the pre-existing line 11 — both are the
Grep: Add include_ignored parameterentry. The rootCHANGELOG.md(lines 14-17) has no such duplicate; only the Shell and Core entries were added there. The duplicate appears to have been introduced by manual editing of the English docs, which perdocs/AGENTS.mdshould be auto-synced from the rootCHANGELOG.mdvia script (npm run sync).Was this helpful? React with 👍 or 👎 to provide feedback.