Skip to content

fix: fix external editor lagging a lot#140

Open
JayanAXHF wants to merge 1 commit into
mainfrom
fix/laggy-nvim
Open

fix: fix external editor lagging a lot#140
JayanAXHF wants to merge 1 commit into
mainfrom
fix/laggy-nvim

Conversation

@JayanAXHF
Copy link
Copy Markdown
Owner

No description provided.

@JayanAXHF JayanAXHF marked this pull request as ready for review April 29, 2026 11:57
Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 29, 2026

Greptile Summary

This PR refactors the external editor integration by moving the editor invocation out of a fire-and-forget tokio::spawn in IssueConversation and into a synchronous, await-ed run_external_editor_session on App. A new EventPump wrapper manages lifecycle of the event-stream task, stopping it before the editor opens and restarting it on return. The EditorModeChanged(bool) action pair is replaced by a single OpenExternalEditor action, and helper functions and unit tests for should_ignore_action_in_editor / editor_result_action are added.

Important Files Changed

Filename Overview
src/ui/mod.rs Core refactor: introduces EventPump lifecycle management and run_external_editor_session; early-error returns from finish_teardown/setup_terminal still leave in_editor=true and event_pump=None, which can freeze the app (flagged in previous review thread)
src/ui/components/issue_conversation.rs Simplified: delegate editor invocation to App via OpenExternalEditor action instead of spawning an inline async task; target mapping and action send are straightforward

Sequence Diagram

sequenceDiagram
    participant IC as IssueConversation
    participant TX as action_tx
    participant App as App
    participant EP as EventPump
    participant Ed as ExternalEditor

    IC->>TX: "OpenExternalEditor {issue_number, target, initial_body}"
    TX->>App: "dispatch in run() loop"
    App->>App: "in_editor = true"
    App->>EP: "stop_event_pump() cancel + join"
    App->>App: "ratatui::restore() + finish_teardown()?"
    App->>Ed: "spawn_blocking(edit::edit)"
    Ed-->>App: "Result<String, String>"
    App->>App: "ratatui::init() + setup_terminal()?"
    App->>EP: "start_event_pump()"
    App->>App: "in_editor = false"
    App->>TX: "IssueBodyEditFinished or IssueCommentEditFinished"
    App->>TX: "ForceRender"
Loading

Reviews (2): Last reviewed commit: "fix: fix external editor lagging a lot" | Re-trigger Greptile

Comment thread src/ui/mod.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant