File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -66,11 +66,13 @@ impl ExternalEditorComponent {
66
66
io:: stdout( ) . execute( EnterAlternateScreen ) . expect( "reset terminal" ) ;
67
67
}
68
68
69
- let editor = env:: var ( "GIT_EDITOR" )
69
+ let environment_options = [ "GIT_EDITOR" , "VISUAL" , "EDITOR" ] ;
70
+
71
+ let editor = env:: var ( environment_options[ 0 ] )
70
72
. ok ( )
71
73
. or_else ( || get_config_string ( CWD , "core.editor" ) . ok ( ) ?)
72
- . or_else ( || env:: var ( "VISUAL" ) . ok ( ) )
73
- . or_else ( || env:: var ( "EDITOR" ) . ok ( ) )
74
+ . or_else ( || env:: var ( environment_options [ 1 ] ) . ok ( ) )
75
+ . or_else ( || env:: var ( environment_options [ 2 ] ) . ok ( ) )
74
76
. unwrap_or_else ( || String :: from ( "vi" ) ) ;
75
77
76
78
// TODO: proper handling arguments containing whitespaces
@@ -82,7 +84,10 @@ impl ExternalEditorComponent {
82
84
let mut echars = editor. chars ( ) . peekable ( ) ;
83
85
84
86
let first_char = * echars. peek ( ) . ok_or_else ( || {
85
- anyhow ! ( "editor configuration set to empty string" )
87
+ anyhow ! (
88
+ "editor env variable found empty: {}" ,
89
+ environment_options. join( " or " )
90
+ )
86
91
} ) ?;
87
92
let command: String = if first_char == '\"' {
88
93
echars
You can’t perform that action at this time.
0 commit comments