improve navigation history via editor tab selection/closure
This commit is contained in:
@@ -57,13 +57,23 @@ public partial class CodeEditorPanel : MarginContainer
|
|||||||
|
|
||||||
private void OnTabClicked(long tab)
|
private void OnTabClicked(long tab)
|
||||||
{
|
{
|
||||||
var sharpIdeFile = _tabContainer.GetChild<SharpIdeCodeEdit>((int)tab).SharpIdeFile;
|
var sharpIdeCodeEdit = _tabContainer.GetChild<SharpIdeCodeEdit>((int)tab);
|
||||||
GodotGlobalEvents.Instance.FileExternallySelected.InvokeParallelFireAndForget(sharpIdeFile, null);
|
var sharpIdeFile = sharpIdeCodeEdit.SharpIdeFile;
|
||||||
|
var caretLinePosition = new SharpIdeFileLinePosition(sharpIdeCodeEdit.GetCaretLine(), sharpIdeCodeEdit.GetCaretColumn());
|
||||||
|
GodotGlobalEvents.Instance.FileExternallySelected.InvokeParallelFireAndForget(sharpIdeFile, caretLinePosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTabClosePressed(long tabIndex)
|
private void OnTabClosePressed(long tabIndex)
|
||||||
{
|
{
|
||||||
var tab = _tabContainer.GetChild<Control>((int)tabIndex);
|
var tab = _tabContainer.GetChild<Control>((int)tabIndex);
|
||||||
|
var previousSibling = _tabContainer.GetChildOrNull<SharpIdeCodeEdit>((int)tabIndex - 1);
|
||||||
|
if (previousSibling is not null)
|
||||||
|
{
|
||||||
|
var sharpIdeFile = previousSibling.SharpIdeFile;
|
||||||
|
var caretLinePosition = new SharpIdeFileLinePosition(previousSibling.GetCaretLine(), previousSibling.GetCaretColumn());
|
||||||
|
// This isn't actually necessary - closing a tab automatically selects the previous tab, however we need to do it to select the file in sln explorer, record navigation event etc
|
||||||
|
GodotGlobalEvents.Instance.FileExternallySelected.InvokeParallelFireAndForget(sharpIdeFile, caretLinePosition);
|
||||||
|
}
|
||||||
_tabContainer.RemoveChild(tab);
|
_tabContainer.RemoveChild(tab);
|
||||||
tab.QueueFree();
|
tab.QueueFree();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user