Skip to content

feat(core): add page up/down to tui shortcuts - #34525

Merged
AgentEnder merged 4 commits into
nrwl:masterfrom
yharaskrik:jay/add-page-up-down-to-nx-tui
Apr 17, 2026
Merged

feat(core): add page up/down to tui shortcuts#34525
AgentEnder merged 4 commits into
nrwl:masterfrom
yharaskrik:jay/add-page-up-down-to-nx-tui

Conversation

@yharaskrik

Copy link
Copy Markdown
Contributor

Current Behavior

Page Up/Down are not implemented as navigation keys in TUI

Expected Behavior

They are now Implemented.

Related Issue(s)

Fixes #

@yharaskrik
yharaskrik requested review from a team as code owners February 20, 2026 06:03
@netlify

netlify Bot commented Feb 20, 2026

Copy link
Copy Markdown

Deploy Preview for nx-docs canceled.

Name Link
🔨 Latest commit 6bf262a
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69e15bbfb8899000086ecdf9
@netlify

netlify Bot commented Feb 20, 2026

Copy link
Copy Markdown

Deploy Preview for nx-dev canceled.

Name Link
🔨 Latest commit 6bf262a
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69e15bbfb69d14000870d1e7
@yharaskrik
yharaskrik force-pushed the jay/add-page-up-down-to-nx-tui branch from d99ca86 to cdae067 Compare February 20, 2026 06:10

@leosvelperez leosvelperez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This was something on my list, but I hadn't gotten to it.

Left some suggestions to avoid the loops and update the scroll state more directly.

// Handle PageUp/PageDown for full-page scrolling when not in interactive mode
KeyCode::PageUp if !self.is_interactive => {
let (rows, _) = pty_mut.get_dimensions();
let page = (rows as u8).saturating_sub(2).max(1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rows is u16 (from get_dimensions()) but as u8 silently keeps only the low 8 bits. For terminals >255 rows (very unlikely, but not impossible), this would wrap unpredictably (e.g., 256 rows → page=1, 300 → page=42).

Suggested change
let page = (rows as u8).saturating_sub(2).max(1);
let page = (rows.min(255) as u8).saturating_sub(2).max(1);
}
KeyCode::PageDown if !self.is_interactive => {
let (rows, _) = pty_mut.get_dimensions();
let page = (rows as u8).saturating_sub(2).max(1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here:

Suggested change
let page = (rows as u8).saturating_sub(2).max(1);
let page = (rows.min(255) as u8).saturating_sub(2).max(1);
Comment on lines +171 to +174
let page = viewport_height.saturating_sub(2).max(1);
for _ in 0..page {
self.scroll_up();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loop calls scroll_up() N times, each doing a bounds check + decrement. Could be a single operation:

Suggested change
let page = viewport_height.saturating_sub(2).max(1);
for _ in 0..page {
self.scroll_up();
}
let page = viewport_height.saturating_sub(2).max(1);
self.scroll_offset = self.scroll_offset.saturating_sub(page);
Comment on lines +180 to +183
let page = viewport_height.saturating_sub(2).max(1);
for _ in 0..page {
self.scroll_down(viewport_height);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here:

Suggested change
let page = viewport_height.saturating_sub(2).max(1);
for _ in 0..page {
self.scroll_down(viewport_height);
}
let page = viewport_height.saturating_sub(2).max(1);
self.scroll_offset = (self.scroll_offset + page).min(max_scroll);
Comment on lines +83 to +86
let page = self.viewport_height.saturating_sub(2).max(1);
for _ in 0..page {
self.scroll_up();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same loop pattern — can be a single offset operation (scrollbar state only needs one update):

Suggested change
let page = self.viewport_height.saturating_sub(2).max(1);
for _ in 0..page {
self.scroll_up();
}
let page = self.viewport_height.saturating_sub(2).max(1);
self.scroll_offset = self.scroll_offset.saturating_sub(page);
self.scrollbar_state = self
.scrollbar_state
.content_length(self.content_height)
.viewport_content_length(self.viewport_height)
.position(self.scroll_offset);
Comment on lines +90 to +93
let page = self.viewport_height.saturating_sub(2).max(1);
for _ in 0..page {
self.scroll_down();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here:

Suggested change
let page = self.viewport_height.saturating_sub(2).max(1);
for _ in 0..page {
self.scroll_down();
}
let page = self.viewport_height.saturating_sub(2).max(1);
let max_scroll = self.content_height.saturating_sub(self.viewport_height);
self.scroll_offset = (self.scroll_offset + page).min(max_scroll);
self.scrollbar_state = self
.scrollbar_state
.content_length(self.content_height)
.viewport_content_length(self.viewport_height)
.position(self.scroll_offset);
@AgentEnder
AgentEnder requested a review from a team as a code owner April 15, 2026 21:09
@nx-cloud

nx-cloud Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 6bf262a

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 49m 30s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 17s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 23s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 8s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-17 00:58:29 UTC

@AgentEnder
AgentEnder force-pushed the jay/add-page-up-down-to-nx-tui branch from 56b16be to 6bf262a Compare April 16, 2026 21:59
@AgentEnder
AgentEnder merged commit 4d15754 into nrwl:master Apr 17, 2026
15 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants