@@ -42,7 +42,7 @@ use crate::{
4242 app:: GITHUB_CLIENT ,
4343 errors:: AppError ,
4444 ui:: {
45- Action ,
45+ Action , ExternalEditorTarget ,
4646 components:: {
4747 Component ,
4848 help:: HelpElementKind ,
@@ -790,40 +790,18 @@ impl IssueConversation {
790790 let Some ( action_tx) = self . action_tx . clone ( ) else {
791791 return ;
792792 } ;
793- if action_tx
794- . send ( Action :: EditorModeChanged ( true ) )
795- . await
796- . is_err ( )
797- {
798- return ;
799- }
793+ let target = match target {
794+ MessageTarget :: IssueBody ( _) => ExternalEditorTarget :: IssueBody ,
795+ MessageTarget :: Comment ( comment_id) => ExternalEditorTarget :: Comment { comment_id } ,
796+ } ;
800797
801- tokio:: spawn ( async move {
802- let result = tokio:: task:: spawn_blocking ( move || {
803- ratatui:: restore ( ) ;
804- let edited = edit:: edit ( & initial_body) . map_err ( |err| err. to_string ( ) ) ;
805- let _ = ratatui:: init ( ) ;
806- edited
798+ let _ = action_tx
799+ . send ( Action :: OpenExternalEditor {
800+ issue_number,
801+ target,
802+ initial_body,
807803 } )
808- . await
809- . map_err ( |err| err. to_string ( ) )
810- . and_then ( |edited| edited. map_err ( |err| err. replace ( '\n' , " " ) ) ) ;
811-
812- let _ = action_tx. send ( Action :: EditorModeChanged ( false ) ) . await ;
813- let action = match target {
814- MessageTarget :: IssueBody ( _) => Action :: IssueBodyEditFinished {
815- issue_number,
816- result,
817- } ,
818- MessageTarget :: Comment ( comment_id) => Action :: IssueCommentEditFinished {
819- issue_number,
820- comment_id,
821- result,
822- } ,
823- } ;
824- let _ = action_tx. send ( action) . await ;
825- let _ = action_tx. send ( Action :: ForceRender ) . await ;
826- } ) ;
804+ . await ;
827805 }
828806
829807 async fn patch_message ( & mut self , issue_number : u64 , target : MessageTarget , body : String ) {
@@ -1998,7 +1976,8 @@ impl Component for IssueConversation {
19981976 } if self
19991977 . current
20001978 . as_ref ( )
2001- . is_some_and ( |seed| seed. number == number) => {
1979+ . is_some_and ( |seed| seed. number == number) =>
1980+ {
20021981 self . reaction_error = None ;
20031982 self . body_reaction_number = Some ( number) ;
20041983 self . body_reactions = Some ( reactions) ;
0 commit comments