Skip to content

Commit 3a653e3

Browse files
authored
Merge pull request #304 from rimrul/installer-editor-improvements
Installer editor improvements
2 parents 1fa681a + 9a9b30d commit 3a653e3

File tree

4 files changed

+64
-20
lines changed

4 files changed

+64
-20
lines changed

ReleaseNotes.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ This package contains software from a number of other projects including Bash, z
4949
* Comes with [OpenSSL v1.1.1i](https://www.openssl.org/news/openssl-1.1.1-notes.html).
5050
* Comes with [cURL v7.74.0](https://curl.haxx.se/changes.html#7_74_0).
5151
* Comes with [Git LFS v2.13.1](https://github.com/git-lfs/git-lfs/releases/tag/v2.13.1).
52+
* Notepad and Wordpad are [now supported](https://github.com/git-for-windows/build-extra/pull/304) as editors without manual configuration.
5253

5354
### Bug Fixes
5455

git-extra/PKGBUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ sha256sums=('9efaf8dccc08c7cddc58cb589bab5aac5c0894661175a344ca02b2aa849382bd'
5858
'640d04d2a2da709419188a986d5e5550ad30df23c7ea9be1a389c37a6b917994'
5959
'17c90698d4dd52dd9f383e72aee54ecea0f62520baf56722de5c83285507c0d9'
6060
'3cd83627f1d20e1108533419fcf33c657cbcf777c3dc39fa7f13748b7d63858a'
61-
'a9ada325a279ce460aeb663a715e4c335d8972f497d48d97ff5524053b1fb43a'
61+
'c580bd3806d864d7e1446d08d881e80d6911d459e6f71fc7b62e9a189d8d1d31'
6262
'ad295ceb2c66aaf5fec85705110f701924eb6733b68663aaa52a90b950f03caa'
6363
'573ab22be9381feade4a4cdeb5e3d0761224e2e85e017be418c7004fb85fa8b5'
6464
'd212e1bbe75a9f81443126701324c9c44c3ed5750dd9822eba754a1799ed13b3'

git-extra/wordpad

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
#!/bin/sh
22

3+
die () {
4+
echo "$*" >&2
5+
exit 1
6+
}
7+
38
WORDPAD="$(ls {"$PROGRAMFILES/Windows NT","$SYSTEMROOT"}/*/wordpad.exe 2>&- | head -1)"
49

5-
test $# = 1 &&
10+
test $# = 1 ||
11+
die "Usage: $0 <file>"
12+
613
case "$1" in
714
\\*|/*|?:*) ;; # do nothing
815
*) set "$(pwd -W)/$1";;
916
esac
1017

11-
test -x "$WORDPAD" && exec "$WORDPAD" "$@"
18+
case "$1" in
19+
*/.git/*) ;; # needs LF line endings
20+
*) exec $WORDPAD "$1" || die "Could not launch $WORDPAD";;
21+
esac
1222

13-
echo "Could not launch $WORDPAD"
14-
exit 1
23+
$WORDPAD "$1" &&
24+
dos2unix.exe "$1" &&
25+
case "$1" in
26+
*/COMMIT_EDITMSG|*\\COMMIT_EDITMSG)
27+
! columns="$(git config format.commitmessagecolumns)" || {
28+
msg="$(fmt.exe -s -w "$columns" "$1" -p '#' | \
29+
fmt.exe -s -w "$columns" -)" &&
30+
printf "%s" "$msg" >"$1"
31+
}
32+
;;
33+
esac

installer/install.iss

+39-15
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ const
330330
GE_SublimeText = 5;
331331
GE_Atom = 6;
332332
GE_VSCodium = 7;
333-
GE_CustomEditor = 8;
333+
GE_Notepad = 8;
334+
GE_Wordpad = 9;
335+
GE_CustomEditor = 10;
334336
335337
// Git Path options.
336338
GP_BashOnly = 1;
@@ -1763,7 +1765,7 @@ begin
17631765
// 1st choice
17641766
Top:=TopOfLabels;
17651767
CbbEditor.Items.Add('Use the Nano editor by default');
1766-
Data:='<RED>(NEW!)</RED> <A HREF=https://www.nano-editor.org/dist/v2.8/nano.html>GNU nano</A> is a small and friendly text editor running in the console'+#13+'window.';
1768+
Data:='<A HREF=https://www.nano-editor.org/dist/v2.8/nano.html>GNU nano</A> is a small and friendly text editor running in the console'+#13+'window.';
17671769
if (not EditorAvailable[GE_NotepadPlusPlus] and not EditorAvailable[GE_VisualStudioCode] and not EditorAvailable[GE_VisualStudioCodeInsiders] and not EditorAvailable[GE_SublimeText] and not EditorAvailable[GE_Atom]) and not EditorAvailable[GE_VSCodium] then
17681770
Data:=Data+#13+#13+'This is the recommended option for end users if no GUI editors are installed.';
17691771
CreateItemDescription(EditorPage,Data,Top,Left,LblEditor[GE_Nano],False);
@@ -1778,51 +1780,63 @@ begin
17781780
// 3rd choice
17791781
Top:=TopOfLabels;
17801782
CbbEditor.Items.Add('Use Notepad++ as Git'+#39+'s default editor');
1781-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://notepad-plus-plus.org/>Notepad++</A> is a popular GUI editor that can be used by Git.'+#13+#13+'This editor is popular in part due to the vast number of available plugins;'+#13+'However, when configured via this option, Git will call Notepad++ with'+#13+'plugins disabled (to open the editor as quickly as possible).',Top,Left,LblEditor[GE_NotepadPlusPlus],False);
1783+
CreateItemDescription(EditorPage,'<A HREF=https://notepad-plus-plus.org/>Notepad++</A> is a popular GUI editor that can be used by Git.'+#13+#13+'This editor is popular in part due to the vast number of available plugins;'+#13+'However, when configured via this option, Git will call Notepad++ with'+#13+'plugins disabled (to open the editor as quickly as possible).',Top,Left,LblEditor[GE_NotepadPlusPlus],False);
17821784
17831785
// 4th choice
17841786
Top:=TopOfLabels;
17851787
CbbEditor.Items.Add('Use Visual Studio Code as Git'+#39+'s default editor');
17861788
if (VisualStudioCodeUserInstallation=False) then
1787-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://code.visualstudio.com//>Visual Studio Code</A> is an Open Source, lightweight and powerful editor'+#13+'running as a desktop application. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+#13+'Use this option to let Git use Visual Studio Code as its default editor.',Top,Left,LblEditor[GE_VisualStudioCode],False)
1789+
CreateItemDescription(EditorPage,'<A HREF=https://code.visualstudio.com//>Visual Studio Code</A> is an Open Source, lightweight and powerful editor'+#13+'running as a desktop application. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+#13+'Use this option to let Git use Visual Studio Code as its default editor.',Top,Left,LblEditor[GE_VisualStudioCode],False)
17881790
else
1789-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://code.visualstudio.com//>Visual Studio Code</A> is an Open Source, lightweight and powerful editor'+#13+'running as a desktop application. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+'<RED>(WARNING!) This will be installed only for this user.</RED>'+#13+#13+'Use this option to let Git use Visual Studio Code as its default editor.',Top,Left,LblEditor[GE_VisualStudioCode],False);
1791+
CreateItemDescription(EditorPage,'<A HREF=https://code.visualstudio.com//>Visual Studio Code</A> is an Open Source, lightweight and powerful editor'+#13+'running as a desktop application. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+'<RED>(WARNING!) This will be installed only for this user.</RED>'+#13+#13+'Use this option to let Git use Visual Studio Code as its default editor.',Top,Left,LblEditor[GE_VisualStudioCode],False);
17901792
17911793
// 5th choice
17921794
Top:=TopOfLabels;
17931795
CbbEditor.Items.Add('Use Visual Studio Code Insiders as Git'+#39+'s default editor');
17941796
if (VisualStudioCodeInsidersUserInstallation=False) then
1795-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://code.visualstudio.com/insiders/>Visual Studio Code</A> is an Open Source, lightweight and powerful editor'+#13+'running as a desktop application. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+#13+'Use this option to let Git use Visual Studio Code Insiders as its default editor.',Top,Left,LblEditor[GE_VisualStudioCodeInsiders],False)
1797+
CreateItemDescription(EditorPage,'<A HREF=https://code.visualstudio.com/insiders/>Visual Studio Code</A> is an Open Source, lightweight and powerful editor'+#13+'running as a desktop application. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+#13+'Use this option to let Git use Visual Studio Code Insiders as its default editor.',Top,Left,LblEditor[GE_VisualStudioCodeInsiders],False)
17961798
else
1797-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://code.visualstudio.com/insiders/>Visual Studio Code</A> is an Open Source, lightweight and powerful editor'+#13+'running as a desktop application. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+'<RED>(WARNING!) This will be installed only for this user.</RED>'+#13+#13+'Use this option to let Git use Visual Studio Code Insiders as its default editor.',Top,Left,LblEditor[GE_VisualStudioCodeInsiders],False);
1799+
CreateItemDescription(EditorPage,'<A HREF=https://code.visualstudio.com/insiders/>Visual Studio Code</A> is an Open Source, lightweight and powerful editor'+#13+'running as a desktop application. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+'<RED>(WARNING!) This will be installed only for this user.</RED>'+#13+#13+'Use this option to let Git use Visual Studio Code Insiders as its default editor.',Top,Left,LblEditor[GE_VisualStudioCodeInsiders],False);
17981800
17991801
// 6th choice
18001802
Top:=TopOfLabels;
18011803
CbbEditor.Items.Add('Use Sublime Text as Git'+#39+'s default editor');
18021804
if (SublimeTextUserInstallation=False) then
1803-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://www.sublimetext.com/>Sublime text</A> is a lightweight editor which supports a great number'+#13+'of plugins.'+#13+#13+'Use this option to let Git use Sublime Text as its default editor.',Top,Left,LblEditor[GE_SublimeText],False)
1805+
CreateItemDescription(EditorPage,'<A HREF=https://www.sublimetext.com/>Sublime text</A> is a lightweight editor which supports a great number'+#13+'of plugins.'+#13+#13+'Use this option to let Git use Sublime Text as its default editor.',Top,Left,LblEditor[GE_SublimeText],False)
18041806
else
1805-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://www.sublimetext.com/>Sublime text</A> is a lightweight editor which supports a great number'+#13+'of plugins.'+#13+'<RED>(WARNING!) This will be installed only for this user.</RED>'+#13+#13+'Use this option to let Git use Sublime Text as its default editor.',Top,Left,LblEditor[GE_SublimeText],False);
1807+
CreateItemDescription(EditorPage,'<A HREF=https://www.sublimetext.com/>Sublime text</A> is a lightweight editor which supports a great number'+#13+'of plugins.'+#13+'<RED>(WARNING!) This will be installed only for this user.</RED>'+#13+#13+'Use this option to let Git use Sublime Text as its default editor.',Top,Left,LblEditor[GE_SublimeText],False);
18061808
18071809
// 7th choice
18081810
Top:=TopOfLabels;
18091811
CbbEditor.Items.Add('Use Atom as Git'+#39+'s default editor');
1810-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://atom.io/>Atom</A> is an open source text editor which comes with builtin support'+#13+'for Git and Github.'+#13+'<RED>(WARNING!) This will be installed only for this user.</RED>'+#13+#13+'Use this option to let Git use Atom as its default editor.',Top,Left,LblEditor[GE_Atom],False);
1812+
CreateItemDescription(EditorPage,'<A HREF=https://atom.io/>Atom</A> is an open source text editor which comes with builtin support'+#13+'for Git and Github.'+#13+'<RED>(WARNING!) This will be installed only for this user.</RED>'+#13+#13+'Use this option to let Git use Atom as its default editor.',Top,Left,LblEditor[GE_Atom],False);
18111813
18121814
// 8th choice
18131815
Top:=TopOfLabels;
18141816
CbbEditor.Items.Add('Use VSCodium as Git'+#39+'s default editor');
18151817
if (VSCodiumUserInstallation=False) then
1816-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://vscodium.com///>VSCodium</A> provides Free/Libre Open Source Software Binaries of VSCode with the same features, but without telemetry/tracking of Microsoft or any non-floss code parts. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+#13+'Use this option to let Git use VSCodium as its default editor.',Top,Left,LblEditor[GE_VSCodium],False)
1818+
CreateItemDescription(EditorPage,'<A HREF=https://vscodium.com///>VSCodium</A> provides Free/Libre Open Source Software Binaries of VSCode with the same features, but without telemetry/tracking of Microsoft or any non-floss code parts. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+#13+'Use this option to let Git use VSCodium as its default editor.',Top,Left,LblEditor[GE_VSCodium],False)
18171819
else
1818-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> <A HREF=https://vscodium.com///>VSCodium</A> provides Free/Libre Open Source Software Binaries of VSCode with the same features, but without telemetry/tracking of Microsoft or any non-floss code parts. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+'<RED>(WARNING!) This will be installed only for this user.</RED>'+#13+#13+'Use this option to let Git use VSCodium as its default editor.',Top,Left,LblEditor[GE_VSCodium],False);
1820+
CreateItemDescription(EditorPage,'<A HREF=https://vscodium.com///>VSCodium</A> provides Free/Libre Open Source Software Binaries of VSCode with the same features, but without telemetry/tracking of Microsoft or any non-floss code parts. It comes with built-in support for JavaScript,'+#13+'TypeScript and Node.js and has a rich ecosystem of extensions for other'+#13+'languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as'+#13+'.NET and Unity).'+#13+'<RED>(WARNING!) This will be installed only for this user.</RED>'+#13+#13+'Use this option to let Git use VSCodium as its default editor.',Top,Left,LblEditor[GE_VSCodium],False);
1821+
1822+
// 9th choice
1823+
Top:=TopOfLabels;
1824+
CbbEditor.Items.Add('Use Notepad as Git'+#39+'s default editor');
1825+
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> Notepad is a simple GUI editor that comes with windows.',Top,Left,LblEditor[GE_Notepad],False);
1826+
EditorAvailable[GE_Notepad]:=True;
1827+
1828+
// 10th choice
1829+
Top:=TopOfLabels;
1830+
CbbEditor.Items.Add('Use Wordpad as Git'+#39+'s default editor');
1831+
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> 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);
1832+
EditorAvailable[GE_Wordpad]:=True;
18191833
18201834
// Custom choice
18211835
Top:=TopOfLabels;
18221836
CbbEditor.Items.Add('Select other editor as Git'+#39+'s default editor');
1823-
CreateItemDescription(EditorPage,'<RED>(NEW!)</RED> Use this option to select the path to Git'+#39+'s default editor.',Top,Left,LblEditor[GE_CustomEditor],False);
1837+
CreateItemDescription(EditorPage,'Use this option to select the path to Git'+#39+'s default editor.',Top,Left,LblEditor[GE_CustomEditor],False);
18241838
1825-
EditorPage.add('Location of editor (plus command-line options, if necessary):','Executable files|*.exe|All files|*.*','.exe');
1839+
EditorPage.add('Location of editor (plus command-line options, if necessary):','Executable files|*.exe;*.cmd;*.bat|All files|*.*','.exe');
18261840
TestCustomEditorButton:=TButton.Create(EditorPage);
18271841
with TestCustomEditorButton do begin
18281842
Parent:=EditorPage.Surface;
@@ -1877,6 +1891,8 @@ begin
18771891
else
18781892
CbbEditor.ItemIndex:=GE_VIM;
18791893
end;
1894+
'Notepad': CbbEditor.ItemIndex:=GE_Notepad;
1895+
'Wordpad': CbbEditor.ItemIndex:=GE_Wordpad;
18801896
'CustomEditor': begin
18811897
CbbEditor.ItemIndex:=GE_CustomEditor;
18821898
EditorPage.Values[0]:=ReplayChoice('Custom Editor Path','');
@@ -3124,7 +3140,11 @@ begin
31243140
GitSystemConfigSet('core.editor','"'+VSCodiumPath+'" --wait')
31253141
else if not ExecAsOriginalUser(AppDir + '\{#MINGW_BITNESS}\bin\git.exe','config --global core.editor "\"'+VSCodiumPath+'\" --wait"','',SW_HIDE,ewWaitUntilTerminated, i) then
31263142
LogError('Could not set VSCodium as core.editor in the gitconfig.')
3127-
end else if ((CbbEditor.ItemIndex=GE_CustomEditor)) and (PathIsValidExecutable(CustomEditorPath)) then
3143+
end else if (CbbEditor.ItemIndex=GE_Notepad) then
3144+
GitSystemConfigSet('core.editor','notepad')
3145+
else if (CbbEditor.ItemIndex=GE_Wordpad) then
3146+
GitSystemConfigSet('core.editor','wordpad')
3147+
else if ((CbbEditor.ItemIndex=GE_CustomEditor)) and (PathIsValidExecutable(CustomEditorPath)) then
31283148
GitSystemConfigSet('core.editor','"'+CustomEditorPath+'" '+CustomEditorOptions);
31293149
31303150
{
@@ -3186,6 +3206,10 @@ begin
31863206
Data:='Atom';
31873207
end else if (CbbEditor.ItemIndex=GE_VSCodium) then begin
31883208
Data:='VSCodium';
3209+
end else if (CbbEditor.ItemIndex=GE_Notepad) then begin
3210+
Data:='Notepad';
3211+
end else if (CbbEditor.ItemIndex=GE_Wordpad) then begin
3212+
Data:='Wordpad';
31893213
end else if (CbbEditor.ItemIndex=GE_CustomEditor) then begin
31903214
Data:='CustomEditor'
31913215
CustomEditorData:=EditorPage.Values[0];

0 commit comments

Comments
 (0)