mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
Debugger: Source View - Added tab size option
This commit is contained in:
parent
2e6a2e5494
commit
a91f8ecf73
4 changed files with 26 additions and 3 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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<byte>(),
|
||||
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;
|
||||
|
|
|
@ -252,7 +252,12 @@
|
|||
Margin="0 5 0 0"
|
||||
/>
|
||||
</c:OptionSection>
|
||||
|
||||
<c:OptionSection Header="{l:Translate lblSourceView}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="{l:Translate lblTabSize}" />
|
||||
<NumericUpDown Value="{Binding Integration.TabSize}" Minimum="1" Maximum="16" />
|
||||
</StackPanel>
|
||||
</c:OptionSection>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
|
|
|
@ -1524,7 +1524,10 @@
|
|||
<Control ID="chkImportWorkRamLabels">Work RAM labels</Control>
|
||||
<Control ID="chkImportOtherLabels">Other labels</Control>
|
||||
<Control ID="chkImportComments">Import comments (restricted to the label types selected above)</Control>
|
||||
|
||||
|
||||
<Control ID="lblSourceView">Source view</Control>
|
||||
<Control ID="lblTabSize">Tab size: </Control>
|
||||
|
||||
<Control ID="tabShortcuts">Shortcuts</Control>
|
||||
<Control ID="tabShared">Shared</Control>
|
||||
<Control ID="tabMemoryTools">Memory Viewer</Control>
|
||||
|
|
Loading…
Add table
Reference in a new issue