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: textual capturing keystrokes during ext editor (#1185)

Kilian Lieretfeb2f32de68a
diff --git a/sweagent/run/inspector_cli.py b/sweagent/run/inspector_cli.py
index 94ae2e72..46e6900e 100644
--- a/sweagent/run/inspector_cli.py
+++ b/sweagent/run/inspector_cli.py
@@ -310,13 +310,15 @@ class FileViewerScreen(ModalScreen):
vs = self.query_one(VerticalScroll)
vs.scroll_to(y=vs.scroll_target_y - 15)
- def action_open_editor(self) -> None:
+ async def action_open_editor(self) -> None:
editor = os.environ.get("EDITOR")
if not editor:
self.app.notify("No editor found in $EDITOR environment variable, cannot perform action", severity="error")
return
try:
- subprocess.run([editor, str(self.path)], check=True)
+ # Suspend the TUI app to restore terminal state before launching editor
+ with self.app.suspend():
+ subprocess.run([editor, str(self.path)], check=True)
except subprocess.CalledProcessError:
pass