8000 Fix: Reset viewport when next/prev step/traj by klieret · Pull Request #948 · SWE-agent/SWE-agent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix: Reset viewport when next/prev step/traj #948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sweagent/run/inspector_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def load_trajectory(self, path: Path, title: str, overview_stats: dict, *, gold_
self.title = title
self.gold_patch = gold_patch
self.overview_stats = overview_stats
self.scroll_top()
self.i_step = -1
self.update_content()

Expand Down Expand Up @@ -126,11 +127,13 @@ def update_content(self) -> None:
def action_next_item(self) -> None:
if self.i_step < self.n_steps:
self.i_step += 1
self.scroll_top()
self.update_content()

def action_previous_item(self) -> None:
if self.i_step > -1:
self.i_step -= 1
self.scroll_top()
self.update_content()

def action_toggle_view(self) -> None:
Expand All @@ -145,6 +148,11 @@ def action_last_item(self) -> None:
self.i_step = self.n_steps - 1
self.update_content()

def scroll_top(self) -> None:
"""Resets scrolling viewport"""
vs = self.query_one(VerticalScroll)
vs.scroll_home(animate=False)

def action_scroll_down(self) -> None:
vs = self.query_one(VerticalScroll)
vs.scroll_to(y=vs.scroll_target_y + 15)
Expand Down
Loading
0