Skip to content

Commit 8714650

Browse files
committed
Stabilize editor typing render path (#28)
1 parent 5ed8707 commit 8714650

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ Rule format:
136136
- Do not push branches or `main` without an explicit user command for that push; local commits are allowed, but network publish actions require clear approval in the current conversation.
137137
- Issue-driven implementation work must create or reference the GitHub issue first, mention the issue number in related commits, and leave issue closure to the user after their verification.
138138
- For feedback issue triage, treat issues assigned to `byskyphy` as implemented and waiting for user verification, and treat unassigned issues as not ready unless issue comments explicitly say otherwise; after the release containing an implemented issue ships, add a comment to that issue with the app version where it was added.
139+
- GitHub Project status `Ready for review` is only for issue work that is implemented, committed, pushed, and covered by a green GitHub Actions release build; do not move issues there while the relevant build is still running or failed.
139140
- Feature or improvement issues must include UI acceptance coverage expectations, and implementation commits for those issues must add or update browser/UI tests unless the issue explicitly documents why UI coverage is not applicable.
140141
- Stakeholder feedback issues should be interpreted as additive feature or presentation requests by default; do not remove existing behavior from wording such as "replace", "remove", or "rename" unless the user explicitly confirms deletion.
141142
- When a CI test job fails, times out, or is cancelled, the workflow summary must still state which tests failed or that the run ended before per-test failure data was available; do not leave browser-suite failures represented only by generic job annotations.

src/PrompterOne.Shared/Editor/Pages/EditorPage.SourceEditing.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,40 @@ private async Task OnHistoryRequestedAsync(EditorHistoryCommand command)
5656

5757
private Task OnSelectionChangedAsync(EditorSelectionViewModel selection)
5858
{
59+
var previousSelection = _selection;
60+
var previousSegmentIndex = _activeSegmentIndex;
61+
var previousBlockIndex = _activeBlockIndex;
62+
5963
_selection = selection;
6064
_history.UpdateSelection(selection.Range);
6165
RefreshSelectionState();
6266
PublishEditorAiContext();
63-
StateHasChanged();
67+
if (ShouldRenderSelectionChange(previousSelection, previousSegmentIndex, previousBlockIndex))
68+
{
69+
StateHasChanged();
70+
}
71+
6472
return Task.CompletedTask;
6573
}
6674

75+
private bool ShouldRenderSelectionChange(
76+
EditorSelectionViewModel previousSelection,
77+
int previousSegmentIndex,
78+
int? previousBlockIndex)
79+
{
80+
if (previousSelection.HasSelection || _selection.HasSelection)
81+
{
82+
return true;
83+
}
84+
85+
if (previousSegmentIndex != _activeSegmentIndex || previousBlockIndex != _activeBlockIndex)
86+
{
87+
return true;
88+
}
89+
90+
return previousSelection.Line != _selection.Line;
91+
}
92+
6793
private Task OnSourceChangedAsync(string text)
6894
{
6995
var sourceText = text ?? string.Empty;

0 commit comments

Comments
 (0)