Skip to content

Commit 0fb1bae

Browse files
authored
fix inpout scroll issues (#14597)
## Description <!-- Please remember to add your design buddy onto the PR for review, if it contains any UI changes! --> Input scrolling was messed up because our calculation for the size of the input was wrong. This fixes that. ## Testing <!-- How did you test this change? What automated tests did you add? If you didn't add any new tests, what's your justification for not adding any? Manual testing is required for changes that can be manually tested, and almost all changes can be manually tested. If your change can be manually tested, please include screenshots or a screen recording that show it working end to end. You can run the app locally using `./script/run` - see AGENTS.md for more details on how to get set up. --> - [x] I have manually tested my changes locally with `./script/run` ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
1 parent 16ec6d4 commit 0fb1bae

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

crates/warp_tui/src/terminal_session_view.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ const INITIAL_INPUT_WIDTH: u16 = 80;
169169
const INLINE_MENU_TOP_PADDING_ROWS: u16 = 1;
170170
const MAX_READ_ONLY_MENU_ROWS: u16 = 10;
171171
const MAX_INPUT_TEXT_ROWS: u16 = 6;
172+
/// Top and bottom border rows plus one padding row inside each border.
173+
const BORDERED_INPUT_CHROME_ROWS: u16 = 4;
172174
const AUTO_APPROVE_FEEDBACK_DURATION: Duration = Duration::from_secs(3);
173175
const VOICE_INPUT_BORDER_REPAINT_INTERVAL: Duration = Duration::from_millis(33);
174176

@@ -2649,7 +2651,7 @@ impl TuiTerminalSessionView {
26492651
}
26502652
content = content.child(
26512653
TuiConstrainedBox::new(input)
2652-
.with_max_rows(MAX_INPUT_TEXT_ROWS + 2)
2654+
.with_max_rows(MAX_INPUT_TEXT_ROWS + BORDERED_INPUT_CHROME_ROWS)
26532655
.finish(),
26542656
);
26552657
let footer = if let Some(footer) = self.api_keys_menu.as_ref(ctx).footer(ctx) {

crates/warp_tui/src/terminal_session_view_tests.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,26 @@ fn render_footer_lines(
13761376
) -> Vec<String> {
13771377
render_footer(app, view, width).to_lines()
13781378
}
1379+
#[test]
1380+
fn input_area_renders_all_six_editor_rows() {
1381+
App::test((), |mut app| async move {
1382+
let fixture = focus_test_fixture(&mut app);
1383+
let (view, _) = add_focus_test_session(&mut app, &fixture, true);
1384+
view.update(&mut app, |view, ctx| {
1385+
view.input_view.update(ctx, |input, ctx| {
1386+
input.set_text("input-0\ninput-1\ninput-2\ninput-3\ninput-4\ninput-5", ctx);
1387+
});
1388+
});
1389+
1390+
let rendered = render_session(&mut app, &view, 80, 24).join("\n");
1391+
for row in 0..6 {
1392+
assert!(
1393+
rendered.contains(&format!("input-{row}")),
1394+
"input row {row} should be visible:\n{rendered}"
1395+
);
1396+
}
1397+
});
1398+
}
13791399

13801400
/// Dispatches `event` into the retained session element tree with the session
13811401
/// view as the action origin, returning whether the tree handled it.

0 commit comments

Comments
 (0)