diff --git a/UI/Config/IntegrationConfig.cs b/UI/Config/IntegrationConfig.cs index 8de02ba6..dea486fd 100644 --- a/UI/Config/IntegrationConfig.cs +++ b/UI/Config/IntegrationConfig.cs @@ -25,6 +25,8 @@ namespace Mesen.Config [Reactive] public bool ImportSaveRamLabels { get; set; } = true; [Reactive] public bool ImportOtherLabels { get; set; } = true; [Reactive] public bool ImportComments { get; set; } = true; + + [Reactive] public int TabSize { get; set; } = 4; public bool IsMemoryTypeImportEnabled(MemoryType memType) { diff --git a/UI/Debugger/ViewModels/SourceViewViewModel.cs b/UI/Debugger/ViewModels/SourceViewViewModel.cs index 0d86881c..4c36992a 100644 --- a/UI/Debugger/ViewModels/SourceViewViewModel.cs +++ b/UI/Debugger/ViewModels/SourceViewViewModel.cs @@ -155,12 +155,25 @@ public class SourceViewViewModel : DisposableViewModel, ISelectableModel Address = lineAddr, AbsoluteAddress = address ?? new AddressInfo() { Address = -1 }, Flags = LineFlags.VerifiedCode | (!showLineAddress ? LineFlags.Empty : LineFlags.None), - Text = file.Data[lineNumber], + Text = ReplaceTabs(file.Data[lineNumber], ConfigManager.Config.Debug.Integration.TabSize), ByteCode = byteCode ?? Array.Empty(), OpSize = (byte)opSize }; } + private string ReplaceTabs(string line, int tabSize) + { + StringBuilder sb = new(); + for(int i = 0; i < line.Length; i++) { + if(line[i] != '\t') { + sb.Append(line[i]); + } else { + sb.Append(' ', tabSize - sb.Length % tabSize); + } + } + return sb.ToString(); + } + private void QuickSearch_OnFind(OnFindEventArgs e) { SourceFileInfo? file = SelectedFile; diff --git a/UI/Debugger/Windows/DebuggerConfigWindow.axaml b/UI/Debugger/Windows/DebuggerConfigWindow.axaml index 184edc4f..ce7aaee7 100644 --- a/UI/Debugger/Windows/DebuggerConfigWindow.axaml +++ b/UI/Debugger/Windows/DebuggerConfigWindow.axaml @@ -252,7 +252,12 @@ Margin="0 5 0 0" /> - + + + + + + diff --git a/UI/Localization/resources.en.xml b/UI/Localization/resources.en.xml index c2bcb2ef..59ab840b 100644 --- a/UI/Localization/resources.en.xml +++ b/UI/Localization/resources.en.xml @@ -1524,7 +1524,10 @@ Work RAM labels Other labels Import comments (restricted to the label types selected above) - + + Source view + Tab size: + Shortcuts Shared Memory Viewer