navigation history v1

This commit is contained in:
Matt Parker
2025-10-29 20:15:32 +10:00
parent ea543034f9
commit 45946bce8c
7 changed files with 104 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
using Godot;
using SharpIDE.Application.Features.NavigationHistory;
namespace SharpIDE.Godot.Features.Navigation;
public partial class ForwardBackwardButtonContainer : HBoxContainer
{
private Button _backwardButton = null!;
private Button _forwardButton = null!;
[Inject] private readonly IdeNavigationHistoryService _navigationHistoryService = null!;
public override void _Ready()
{
_backwardButton = GetNode<Button>("BackwardButton");
_forwardButton = GetNode<Button>("ForwardButton");
}
}

View File

@@ -0,0 +1 @@
uid://cao2o2singwnb

View File

@@ -0,0 +1,16 @@
[gd_scene load_steps=2 format=3 uid="uid://bgpc5vsddmakc"]
[ext_resource type="Script" uid="uid://cao2o2singwnb" path="res://Features/Navigation/ForwardBackwardButtonContainer.cs" id="1_vep4b"]
[node name="ForwardBackwardButtonContainer" type="HBoxContainer"]
script = ExtResource("1_vep4b")
[node name="ForwardButton" type="Button" parent="."]
layout_mode = 2
size_flags_vertical = 4
text = " < "
[node name="BackwardButton" type="Button" parent="."]
layout_mode = 2
size_flags_vertical = 4
text = " > "

View File

@@ -4,6 +4,7 @@ using Godot;
using ObservableCollections;
using R3;
using SharpIDE.Application.Features.Analysis;
using SharpIDE.Application.Features.NavigationHistory;
using SharpIDE.Application.Features.SolutionDiscovery;
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
using SharpIDE.Godot.Features.Common;
@@ -27,6 +28,8 @@ public partial class SolutionExplorerPanel : MarginContainer
public SharpIdeSolutionModel SolutionModel { get; set; } = null!;
private Tree _tree = null!;
private TreeItem _rootItem = null!;
[Inject] private readonly IdeNavigationHistoryService _navigationHistoryService = null!;
private enum ClipboardOperation { Cut, Copy }
private (List<IFileOrFolder>, ClipboardOperation)? _itemsOnClipboard;
@@ -101,6 +104,7 @@ public partial class SolutionExplorerPanel : MarginContainer
_tree.QueueRedraw();
});
}
_navigationHistoryService.RecordNavigation(file, fileLinePosition ?? new SharpIdeFileLinePosition(0, 0));
await task.ConfigureAwait(false);
}