Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

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

Kilian Lieret7b5a48de27d8
diff --git a/sweagent/run/inspector_cli.py b/sweagent/run/inspector_cli.py
index 9cad7ab9..9f63fc5c 100644
--- a/sweagent/run/inspector_cli.py
+++ b/sweagent/run/inspector_cli.py
@@ -64,6 +64,7 @@ class TrajectoryViewer(Static):
self.title = title
self.gold_patch = gold_patch
self.overview_stats = overview_stats
+ self.scroll_top()
self.i_step = -1
self.update_content()
@@ -126,11 +127,13 @@ class TrajectoryViewer(Static):
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:
@@ -145,6 +148,11 @@ class TrajectoryViewer(Static):
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)