Prefill rename prompt with current thread name (#18057)

Addresses #12178

Problem: The TUI /rename prompt opened blank even when the current
thread already had a custom name, making small edits awkward.

Solution: Let custom prompts receive initial text and prefill /rename
with the existing thread name while preserving the empty prompt for
unnamed threads.

Testing: Manually verified that the feature works by using `/rename`
with unnamed and already-named threads.
This commit is contained in:
Eric Traut authored and GitHub committed 2026-04-16 09:01:45 -07:00
1 parent 9c6d038622
commit 9c56e89e4f
4 files changed
+55 -6

No files matched your search

@@ -41,15 +41,22 @@ impl CustomPromptView {
pub(crate) fn new(
title: String,
placeholder: String,
initial_text: String,
context_label: Option<String>,
on_submit: PromptSubmitted,
) -> Self {
let mut textarea = TextArea::new();
if !initial_text.is_empty() {
textarea.set_text_clearing_elements(&initial_text);
textarea.set_cursor(initial_text.len());
}
Self {
title,
placeholder,
context_label,
on_submit,
textarea: TextArea::new(),
textarea,
textarea_state: RefCell::new(TextAreaState::default()),
complete: false,
}