agent: Fix long previous user message double scroll (#33056)
Previously, if editing a long previous user message in the thread, you'd have a double scroll situation because the editor used in that case had its max number of lines capped. To solve that, I made the `max_lines` in the editor `AutoHeight` mode optional, allowing me to not pass any arbitrary number to the previous user message editor, and ultimately, solving the double scroll problem by not having any scroll at all. Release Notes: - agent: Fixed double scroll that happened when editing a long previous user message. @ConradIrwin adding you as a reviewer as I'm touching editor code here... want to be careful. :)
This commit is contained in:
parent
272fc672af
commit
16f1da1b7e
7 changed files with 47 additions and 20 deletions
|
@ -487,7 +487,7 @@ pub enum EditorMode {
|
|||
},
|
||||
AutoHeight {
|
||||
min_lines: usize,
|
||||
max_lines: usize,
|
||||
max_lines: Option<usize>,
|
||||
},
|
||||
Full {
|
||||
/// When set to `true`, the editor will scale its UI elements with the buffer font size.
|
||||
|
@ -1650,7 +1650,28 @@ impl Editor {
|
|||
Self::new(
|
||||
EditorMode::AutoHeight {
|
||||
min_lines,
|
||||
max_lines,
|
||||
max_lines: Some(max_lines),
|
||||
},
|
||||
buffer,
|
||||
None,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
}
|
||||
|
||||
/// Creates a new auto-height editor with a minimum number of lines but no maximum.
|
||||
/// The editor grows as tall as needed to fit its content.
|
||||
pub fn auto_height_unbounded(
|
||||
min_lines: usize,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Self {
|
||||
let buffer = cx.new(|cx| Buffer::local("", cx));
|
||||
let buffer = cx.new(|cx| MultiBuffer::singleton(buffer, cx));
|
||||
Self::new(
|
||||
EditorMode::AutoHeight {
|
||||
min_lines,
|
||||
max_lines: None,
|
||||
},
|
||||
buffer,
|
||||
None,
|
||||
|
@ -22718,7 +22739,7 @@ impl BreakpointPromptEditor {
|
|||
let mut prompt = Editor::new(
|
||||
EditorMode::AutoHeight {
|
||||
min_lines: 1,
|
||||
max_lines: Self::MAX_LINES as usize,
|
||||
max_lines: Some(Self::MAX_LINES as usize),
|
||||
},
|
||||
buffer,
|
||||
None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue