Skip to content

Commit 500cda0

Browse files
mjcheethamrimrul
authored andcommitted
install.iss: add Microsoft Edit as an editor option
Add the newly re-written and open-source 'Edit' terminal-based text editor, inspired by the old MS-DOS Editor. While the edit.exe program is also available as a simple zip download, or via the WinGet package manager for Windows, it is also distributed via Windows Update on Windows 11 24H2 and newer. Since that's the only system-wide install with a stable path, we currently only support that install method. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com> Signed-off-by: Matthias Aßhauer <mha1993@live.de>
1 parent 2e98702 commit 500cda0

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

installer/install.iss

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,9 @@ const
348348
GE_VSCodium = 7;
349349
GE_Notepad = 8;
350350
GE_Wordpad = 9;
351-
GE_CustomEditor = 10;
352-
GE_MaxEditor = 10;
351+
GE_MicrosoftEdit = 10;
352+
GE_CustomEditor = 11;
353+
GE_MaxEditor = 11;
353354
354355
// Git Path options.
355356
GP_BashOnly = 1;
@@ -472,6 +473,7 @@ var
472473
SublimeTextPath:String;
473474
AtomPath:String;
474475
VSCodiumPath:String;
476+
MicrosoftEditPath:String;
475477
CustomEditorPath:String;
476478
CustomEditorOptions:String;
477479
@@ -1884,6 +1886,11 @@ begin
18841886
Result:=ExtractFilePath(ExtractCommandPath(Command)) + Suffix;
18851887
end;
18861888
1889+
function GetMicrosoftEditPath:String;
1890+
begin
1891+
Result:=ExpandConstant('{sys}\edit.exe');
1892+
end;
1893+
18871894
procedure QueryUninstallValues; forward;
18881895
18891896
function IsHiddenExperimentalOptionsPageEmpty:Boolean;
@@ -1987,6 +1994,10 @@ begin
19871994
VSCodiumUserInstallation:=True;
19881995
end;
19891996
1997+
// We currently only support Edit from Windows Update
1998+
MicrosoftEditPath:=GetMicrosoftEditPath();
1999+
EditorAvailable[GE_MicrosoftEdit]:=GetWindowsVersion >= $0A0065F4 and PathIsValidExecutable(MicrosoftEditPath);
2000+
19902001
// Remove `" %1"` from end and unqote the string.
19912002
if (EditorAvailable[GE_VisualStudioCode]) then
19922003
VisualStudioCodePath:=ExtractCodeCLIPath(VisualStudioCodePath, 'bin\code');
@@ -2068,6 +2079,11 @@ begin
20682079
CreateItemDescription(EditorPage,'Wordpad is a basic word processor that comes with Windows.'+#13+'It can also be used as a text editor.',Top,Left,LblEditor[GE_Wordpad],False);
20692080
EditorAvailable[GE_Wordpad]:=True;
20702081
2082+
// 11th choice
2083+
Top:=TopOfLabels;
2084+
CbbEditor.Items.Add('Use Microsoft Edit as Git'+#39+'s default editor');
2085+
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://github.com/microsoft/edit>Edit</A> is an open source terminal-based text editor which is based on the'+#13+'classic MS-DOS text editor.',Top,Left,LblEditor[GE_MicrosoftEdit],False);
2086+
20712087
// Custom choice
20722088
Top:=TopOfLabels;
20732089
CbbEditor.Items.Add('Select other editor as Git'+#39+'s default editor');
@@ -2130,6 +2146,12 @@ begin
21302146
end;
21312147
'Notepad': CbbEditor.ItemIndex:=GE_Notepad;
21322148
'Wordpad': CbbEditor.ItemIndex:=GE_Wordpad;
2149+
'MicrosoftEdit': begin
2150+
if EditorAvailable[GE_MicrosoftEdit] then
2151+
CbbEditor.ItemIndex:=GE_MicrosoftEdit
2152+
else
2153+
CbbEditor.ItemIndex:=GE_VIM;
2154+
end;
21332155
'CustomEditor': begin
21342156
CbbEditor.ItemIndex:=GE_CustomEditor;
21352157
EditorPage.Values[0]:=ReplayChoice('Custom Editor Path','');
@@ -3572,6 +3594,8 @@ begin
35723594
GitSystemConfigSet('core.editor','notepad')
35733595
else if (CbbEditor.ItemIndex=GE_Wordpad) then
35743596
GitSystemConfigSet('core.editor','wordpad')
3597+
else if (CbbEditor.ItemIndex=GE_MicrosoftEdit) then
3598+
GitSystemConfigSet('core.editor','edit')
35753599
else if ((CbbEditor.ItemIndex=GE_CustomEditor)) and (PathIsValidExecutable(CustomEditorPath)) then
35763600
GitSystemConfigSet('core.editor','"'+CustomEditorPath+'" '+CustomEditorOptions);
35773601
@@ -3642,6 +3666,8 @@ begin
36423666
Data:='Notepad';
36433667
end else if (CbbEditor.ItemIndex=GE_Wordpad) then begin
36443668
Data:='Wordpad';
3669+
end else if (CbbEditor.ItemIndex=GE_MicrosoftEdit) then begin
3670+
Data:='MicrosoftEdit';
36453671
end else if (CbbEditor.ItemIndex=GE_CustomEditor) then begin
36463672
Data:='CustomEditor'
36473673
CustomEditorData:=EditorPage.Values[0];

0 commit comments

Comments
 (0)