set selected tab

This commit is contained in:
Matt Parker
2025-10-22 21:14:32 +10:00
parent aec76cc10e
commit 8e037a582d
4 changed files with 16 additions and 7 deletions

View File

@@ -34,13 +34,15 @@ public partial class CodeEditorPanel : MarginContainer
public override void _ExitTree()
{
var selectedTabIndex = _tabContainer.CurrentTab;
var thisSolution = Singletons.AppState.RecentSlns.Single(s => s.FilePath == Solution.FilePath);
thisSolution.IdeSolutionState.OpenTabs = _tabContainer.GetChildren().OfType<SharpIdeCodeEdit>()
.Select(t => new OpenTab
.Select((t, index) => new OpenTab
{
FilePath = t.SharpIdeFile.Path,
CaretLine = t.GetCaretLine(),
CaretColumn = t.GetCaretColumn()
CaretColumn = t.GetCaretColumn(),
IsSelected = index == selectedTabIndex
})
.ToList();
}
@@ -103,8 +105,7 @@ public partial class CodeEditorPanel : MarginContainer
}).AddTo(newTab); // needs to be on ui thread
});
await newTab.SetSharpIdeFile(file);
if (fileLinePosition is not null) await this.InvokeAsync(() => newTab.SetFileLinePosition(fileLinePosition.Value));
await newTab.SetSharpIdeFile(file, fileLinePosition);
}
private async Task OnDebuggerExecutionStopped(ExecutionStopInfo executionStopInfo)