Skip to content

Commit 7a1e408

Browse files
committed
Added option to disable autocomplete
1 parent 430d18e commit 7a1e408

4 files changed

Lines changed: 21 additions & 8 deletions

File tree

ZXBStudio/Classes/ZXOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ public static void SaveCurrentSettings()
4343
public string LastProjectPath { get; set; }
4444
public ZXBuildSettings? DefaultBuildSettings { get; set; }
4545
public string? NextEmulatorPath { get; set; }
46+
public bool DisableAuto { get; set; }
4647
}
4748
}

ZXBStudio/Dialogs/ZXOptionsDialog.axaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@
3838
<TextBox Classes="dialog" Grid.Row="8" Grid.Column="2" Name="txtNextEmulator" IsReadOnly="True"></TextBox>
3939
<Button Classes="dialog" Grid.Row="8" Grid.Column="3" VerticalAlignment="Center" Name="btnSelectNextEmulator">...</Button>
4040

41-
<Button Classes="dialog" Grid.Row="9" Grid.Column="2" Padding="6" VerticalAlignment="Center" Name="btnKeybMap">Keyboard mappings</Button>
42-
<Button Classes="dialog" Grid.Row="10" Grid.Column="2" Padding="6" VerticalAlignment="Center" Name="btnDefaultBuildConfig">Default build options</Button>
41+
<TextBlock Classes="dialog" Grid.Row="9" Grid.Column="1" VerticalAlignment="Center">Disable autocomplete:</TextBlock>
42+
<CheckBox Classes="dialog" Name="ckDisableAuto" Grid.Column="2" Grid.Row="9"></CheckBox>
43+
44+
<StackPanel Spacing="10" Margin="0,0,0,0" Grid.Row="10" Grid.ColumnSpan="5" Grid.RowSpan="1" Orientation="Horizontal" HorizontalAlignment="Center">
45+
<Button Classes="dialog" Margin="0" Padding="6" VerticalAlignment="Center" Name="btnDefaultBuildConfig">Default build options</Button>
46+
<Button Classes="dialog" Margin="0" Padding="6" VerticalAlignment="Center" Name="btnKeybMap">Keyboard mappings</Button>
47+
</StackPanel>
48+
4349
<StackPanel Margin="0,0,0,10" Grid.Row="11" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Right">
4450
<Button Classes="dialog" VerticalAlignment="Bottom" Padding="7" Name="btnCancel">Cancel</Button>
4551
<Button Classes="dialog" VerticalAlignment="Bottom" Padding="7" Name="btnAccept">Accept</Button>

ZXBStudio/Dialogs/ZXOptionsDialog.axaml.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public ZXOptionsDialog()
1919
btnSelectZxbasm.Click += BtnSelectZxbasm_Click;
2020
btnDefaultBuildConfig.Click += BtnDefaultBuildConfig_Click;
2121
btnSelectNextEmulator.Click += BtnSelectNextEmulator_Click;
22-
2322
txtZxbasm.Text = ZXOptions.Current.ZxbasmPath;
2423
txtZxbc.Text = ZXOptions.Current.ZxbcPath;
2524
nudFontSize.Value = (decimal)ZXOptions.Current.EditorFontSize;
@@ -29,9 +28,10 @@ public ZXOptionsDialog()
2928
ckBorderless.IsChecked = ZXOptions.Current.Borderless;
3029
ckAntiAlias.IsChecked = ZXOptions.Current.AntiAlias;
3130
txtNextEmulator.Text = ZXOptions.Current.NextEmulatorPath;
31+
ckDisableAuto.IsChecked = ZXOptions.Current.DisableAuto;
3232

3333
btnKeybMap.Click += BtnKeybMap_Click;
34-
}
34+
}
3535

3636
private void BtnKeybMap_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
3737
{
@@ -61,8 +61,7 @@ private async void BtnSelectZxbasm_Click(object? sender, Avalonia.Interactivity.
6161
Title = "Select ZXBASM path...",
6262
FileTypeFilter = new[]
6363
{
64-
new FilePickerFileType("ZXBASM executable") { Patterns = new[] { "zxbasm.exe" } },
65-
new FilePickerFileType("All files") { Patterns = new[] { "*", "*.*" } }
64+
new FilePickerFileType("ZXBASM executable") { Patterns = new[] { "*" } }
6665
}
6766
});
6867

@@ -78,8 +77,7 @@ private async void BtnSelectZxbc_Click(object? sender, Avalonia.Interactivity.Ro
7877
Title = "Select ZXBC path...",
7978
FileTypeFilter = new[]
8079
{
81-
new FilePickerFileType("ZXBC executable") { Patterns = new[] { "zxbc.exe" } },
82-
new FilePickerFileType("All files") { Patterns = new[] { "*", "*.*" } }
80+
new FilePickerFileType("ZXBC executable") { Patterns = new[] { "*" } }
8381
}
8482
});
8583

@@ -137,6 +135,7 @@ private async void BtnAccept_Click(object? sender, Avalonia.Interactivity.Routed
137135
ZXOptions.Current.Borderless = ckBorderless.IsChecked ?? false;
138136
ZXOptions.Current.AntiAlias = ckAntiAlias.IsChecked ?? false;
139137
ZXOptions.Current.NextEmulatorPath = txtNextEmulator.Text;
138+
ZXOptions.Current.DisableAuto = ckDisableAuto.IsChecked ?? false;
140139

141140
if (bsett != null)
142141
ZXOptions.Current.DefaultBuildSettings = bsett;

ZXBStudio/DocumentEditors/ZXTextEditor/Controls/ZXBasicEditor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Text;
88
using System.Text.RegularExpressions;
99
using System.Threading.Tasks;
10+
using ZXBasicStudio.Classes;
1011
using ZXBasicStudio.DocumentEditors.ZXTextEditor.Classes.Folding;
1112
using ZXBasicStudio.DocumentEditors.ZXTextEditor.Classes.LanguageDefinitions;
1213
using ZXBasicStudio.IntegratedDocumentTypes.CodeDocuments.Basic;
@@ -472,6 +473,12 @@ public ZXBasicEditor(string DocumentPath) : base(DocumentPath, ZXBasicDocument.I
472473

473474
var context = GetContext(Document, line.Offset + Column);
474475

476+
if (!ByRequest)
477+
{
478+
if(ZXOptions.Current.DisableAuto)
479+
return null;
480+
}
481+
475482
if (ByRequest)
476483
{
477484

0 commit comments

Comments
 (0)