@@ -336,60 +336,71 @@ end;
336336
337337const
338338 // Git Editor options.
339- GE_Nano = 0 ;
340- GE_VIM = 1 ;
341- GE_NotepadPlusPlus = 2 ;
342- GE_VisualStudioCode = 3 ;
339+ GE_Nano = 0 ;
340+ GE_VIM = 1 ;
341+ GE_NotepadPlusPlus = 2 ;
342+ GE_VisualStudioCode = 3 ;
343343 GE_VisualStudioCodeInsiders = 4 ;
344- GE_SublimeText = 5 ;
345- GE_Atom = 6 ;
346- GE_VSCodium = 7 ;
347- GE_Notepad = 8 ;
348- GE_Wordpad = 9 ;
349- GE_CustomEditor = 10 ;
344+ GE_SublimeText = 5 ;
345+ GE_Atom = 6 ;
346+ GE_VSCodium = 7 ;
347+ GE_Notepad = 8 ;
348+ GE_Wordpad = 9 ;
349+ GE_CustomEditor = 10 ;
350+ GE_MaxEditor = 10 ;
350351
351352 // Git Path options.
352353 GP_BashOnly = 1 ;
353354 GP_Cmd = 2 ;
354355 GP_CmdTools = 3 ;
356+ GP_MaxPath = 3 ;
355357
356358 // Default Branch options.
357359 DB_Unspecified = 1 ;
358360 DB_Manual = 2 ;
361+ DB_MaxBranch = 2 ;
359362
360363 // Git SSH options.
361364 GS_OpenSSH = 1 ;
362365 GS_Plink = 2 ;
363366 GS_ExternalOpenSSH = 3 ;
367+ GS_MaxSSH = 3 ;
364368
365369 // Git HTTPS (cURL) options.
366370 GC_OpenSSL = 1 ;
367371 GC_WinSSL = 2 ;
372+ GC_MaxHTTPS = 2 ;
368373
369374 // Git line ending conversion options.
370375 GC_LFOnly = 1 ;
371376 GC_CRLFAlways = 2 ;
372377 GC_CRLFCommitAsIs = 3 ;
378+ GC_MaxAutoCRLF = 3 ;
373379
374380 // Git Bash terminal settings.
375381 GB_MinTTY = 1 ;
376382 GB_ConHost = 2 ;
383+ GB_MaxTerminal = 2 ;
377384
378385 // `git pull` behavior settings.
379386 GP_GitPullMerge = 1 ;
380387 GP_GitPullRebase = 2 ;
381388 GP_GitPullFFOnly = 3 ;
389+ GP_MaxPull = 3 ;
382390
383391 // Git Credential Manager settings.
384392 GCM_None = 1 ;
385393 GCM = 2 ;
394+ GCM_Max = 2 ;
386395
387396 // Extra options
388397 GP_FSCache = 1 ;
389398 GP_Symlinks = 2 ;
399+ GP_MaxExtra = 2 ;
390400
391401 // Security options
392402 SO_MandatoryASLR = 1 ;
403+ SO_MaxSecurity = 1 ;
393404
394405#ifdef WITH_EXPERIMENTAL_BUILTIN_DIFFTOOL
395406#define HAVE_EXPERIMENTAL_OPTIONS 1
@@ -423,6 +434,7 @@ const
423434 GP_BuiltinAddI = 4 ;
424435 GP_EnablePCon = 5 ;
425436 GP_EnableFSMonitor = 6 ;
437+ GP_MaxExperimental = 6 ;
426438#endif
427439
428440var
443455 // Wizard page and variables for the Editor options.
444456 EditorPage:TInputFileWizardPage;
445457 CbbEditor:TNewComboBox;
446- LblEditor:array [GE_Nano..GE_CustomEditor ] of array of TLabel;
447- EditorAvailable:array [GE_Nano..GE_CustomEditor ] of Boolean;
458+ LblEditor:array [0 ..GE_MaxEditor ] of array of TLabel;
459+ EditorAvailable:array [0 ..GE_MaxEditor ] of Boolean;
448460 SelectedEditor:Integer;
449461
450462 VisualStudioCodeUserInstallation:Boolean;
@@ -468,45 +480,45 @@ var
468480
469481 // Wizard page and variables for the Path options.
470482 PathPage:TWizardPage;
471- RdbPath:array [GP_BashOnly..GP_CmdTools ] of TRadioButton;
483+ RdbPath:array [1 ..GP_MaxPath ] of TRadioButton;
472484
473485 // Wizard page and variables for the SSH options.
474486 SSHChoicePage:TWizardPage;
475- RdbSSH:array [GS_OpenSSH..GS_ExternalOpenSSH ] of TRadioButton;
487+ RdbSSH:array [1 ..GS_MaxSSH ] of TRadioButton;
476488 EdtPlink:TEdit;
477489 TortoisePlink:TCheckBox;
478490
479491 // Wizard page and variables for the HTTPS implementation (cURL) settings.
480492 CurlVariantPage:TWizardPage;
481- RdbCurlVariant:array [GC_OpenSSL..GC_WinSSL ] of TRadioButton;
493+ RdbCurlVariant:array [1 ..GC_MaxHTTPS ] of TRadioButton;
482494
483495 // Wizard page and variables for the line ending conversion options.
484496 CRLFPage:TWizardPage;
485- RdbCRLF:array [GC_LFOnly..GC_CRLFCommitAsIs ] of TRadioButton;
497+ RdbCRLF:array [1 ..GC_MaxAutoCRLF ] of TRadioButton;
486498
487499 // Wizard page and variables for the terminal emulator settings.
488500 BashTerminalPage:TWizardPage;
489- RdbBashTerminal:array [GB_MinTTY..GB_ConHost ] of TRadioButton;
501+ RdbBashTerminal:array [1 ..GB_MaxTerminal ] of TRadioButton;
490502
491503 // Wizard page and variables for the `git pull` options.
492504 GitPullBehaviorPage:TWizardPage;
493- RdbGitPullBehavior:array [GP_GitPullMerge..GP_GitPullFFOnly ] of TRadioButton;
505+ RdbGitPullBehavior:array [1 ..GP_MaxPull ] of TRadioButton;
494506
495507 // Wizard page and variables for the credential manager options.
496508 GitCredentialManagerPage:TWizardPage;
497- RdbGitCredentialManager:array [GCM_None..GCM ] of TRadioButton;
509+ RdbGitCredentialManager:array [1 ..GCM_Max ] of TRadioButton;
498510
499511 // Wizard page and variables for the extra options.
500512 ExtraOptionsPage:TWizardPage;
501- RdbExtraOptions:array [GP_FSCache..GP_Symlinks ] of TCheckBox;
513+ RdbExtraOptions:array [1 ..GP_MaxExtra ] of TCheckBox;
502514
503515 SecurityOptionsPage:TWizardPage;
504- RdbSecurityOptions:array [SO_MandatoryASLR..SO_MandatoryASLR ] of TCheckBox;
516+ RdbSecurityOptions:array [1 ..SO_MaxSecurity ] of TCheckBox;
505517
506518#ifdef HAVE_EXPERIMENTAL_OPTIONS
507519 // Wizard page and variables for the experimental options.
508520 ExperimentalOptionsPage:TWizardPage;
509- RdbExperimentalOptions:array [GP_BuiltinDifftool..GP_EnableFSMonitor ] of TCheckBox;
521+ RdbExperimentalOptions:array [1 ..GP_MaxExperimental ] of TCheckBox;
510522#endif
511523
512524 // Mapping controls to hyperlinks
@@ -1872,6 +1884,18 @@ end;
18721884
18731885procedure QueryUninstallValues ; forward ;
18741886
1887+ function IsHiddenExperimentalOptionsPageEmpty :Boolean;
1888+ var
1889+ i:Integer;
1890+ begin
1891+ Result:=True;
1892+ #ifdef HAVE_EXPERIMENTAL_OPTIONS
1893+ for i:=1 to GP_MaxExperimental do
1894+ if (RdbExperimentalOptions[i]<>nil ) and RdbExperimentalOptions[i].Visible then
1895+ Result:=False;
1896+ #endif
1897+ end ;
1898+
18751899procedure InitializeWizard ;
18761900var
18771901 PrevPageID,TabOrder,TopOfLabels,Top,Left:Integer;
@@ -2502,6 +2526,8 @@ begin
25022526#endif
25032527
25042528 PageIDBeforeInstall:=CurrentCustomPageID;
2529+ if (PageIDBeforeInstall=ExperimentalOptionsPage.ID) and IsHiddenExperimentalOptionsPageEmpty then
2530+ PageIDBeforeInstall:=PageIDBeforeInstall-1 ;
25052531
25062532 (*
25072533 * Create a custom page for finding the processes that lock a module.
@@ -2577,7 +2603,10 @@ begin
25772603 Result:=False
25782604 else
25792605 Result:=(PageID<>wpInfoBefore) and (PageID<>wpFinished);
2580- end else
2606+ end else if (PageID=ExperimentalOptionsPage.ID) and IsHiddenExperimentalOptionsPageEmpty then
2607+ // Skip experimental options page if all options are hidden
2608+ Result:=True
2609+ else
25812610 Result:=False;
25822611#ifdef DEBUG_WIZARD_PAGE
25832612 Result:=PageID<>DebugWizardPage
0 commit comments