trading_agent.terminal.widgets.history_search
¶
A dialog for finding an earlier prompt, opened with Ctrl+R as in Claude Code.
It returns the chosen prompt, or None when the user presses Escape.
Typical usage example:
app.push_screen(HistorySearch(history), on_chosen)
HistorySearch
¶
Bases: ModalScreen[str | None]
The search box and its matches.
Creates the dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
history
|
PromptHistory
|
The earlier prompts. |
required |
Source code in src/trading_agent/terminal/widgets/history_search.py
compose
¶
Builds the dialog.
Yields:
| Type | Description |
|---|---|
Widget
|
The title, the search box, the matches and the hint. |
Source code in src/trading_agent/terminal/widgets/history_search.py
on_mount
¶
on_input_changed
¶
Lists the prompts that match the search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Changed
|
The new search text. |
required |
on_key
¶
Moves through the matches while the search box has the focus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Key
|
The key press. |
required |
Source code in src/trading_agent/terminal/widgets/history_search.py
on_input_submitted
¶
Uses the highlighted prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Submitted
|
The submission. |
required |
Source code in src/trading_agent/terminal/widgets/history_search.py
on_option_list_option_selected
¶
Uses a clicked prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
OptionSelected
|
The choice. |
required |