forked from 1b-agent/opencadstudio-upstream
fix(commandline): pin active step prompt instead of fading
The current step's prompt was written into the command-line widget label. Instead, keep it as a normal history line but freeze its cooldown: the step prompt is pinned so it does not fade while the user is still on that step. When the step changes the previous line's cooldown restarts; when the command ends the pin clears and it fades. `update` is now a thin wrapper that mirrors the active command's prompt into the command line after each message; the body moved to `update_inner`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
0ee8f5265d
commit
b3aadf569e
3 files changed
+53
-20
No files matched your search
@@ -50,6 +50,18 @@ fn format_size(bytes: u64) -> String {
|
||||
|
||||
impl OpenCADStudio {
|
||||
pub fn update(&mut self, msg: Message) -> Task<Message> {
|
||||
let task = self.update_inner(msg);
|
||||
// After every message, mirror the active command step's prompt so
|
||||
// its history line stays pinned (non-fading) until the step changes.
|
||||
let prompt = self.tabs[self.active_tab]
|
||||
.active_cmd
|
||||
.as_ref()
|
||||
.map(|c| c.prompt());
|
||||
self.command_line.set_step_prompt(prompt);
|
||||
task
|
||||
}
|
||||
|
||||
fn update_inner(&mut self, msg: Message) -> Task<Message> {
|
||||
match msg {
|
||||
Message::Tick(t) => {
|
||||
let i = self.active_tab;
|
||||
|
||||
+1
-6
@@ -1177,13 +1177,8 @@ impl OpenCADStudio {
|
||||
&& !tab.dyn_fields.is_empty())
|
||||
|| self.mtext_editor.as_ref().is_some_and(|e| e.show_preview)
|
||||
|| self.text_inline.is_some();
|
||||
let active_prompt = tab.active_cmd.as_ref().map(|c| c.prompt());
|
||||
let command_line_overlay =
|
||||
iced::widget::container(self.command_line.view(
|
||||
allow_autocomplete,
|
||||
dyn_capturing,
|
||||
active_prompt,
|
||||
))
|
||||
iced::widget::container(self.command_line.view(allow_autocomplete, dyn_capturing))
|
||||
.width(Fill)
|
||||
.height(Fill)
|
||||
.align_x(iced::alignment::Horizontal::Center)
|
||||
|
||||
Reference in new issue
Block a user