Fixed deletion checking bug that could cause misreading of the control+r prompt.

This commit is contained in:
Storm Dragon committed 2026-10-28 01:24:03 -04:00
1 parent 57799cd2eb
commit 901fd58ba8
2 files changed
+25 -1

No files matched your search

+4 -1
View File
@@ -78,7 +78,10 @@ func changes(previous, next screen.Snapshot, cursorEcho bool) []presentation.Mes
if len(changedRows) == 1 && scrollStart == scrollEnd {
row := changedRows[0]
before, after := previous.Line(row), next.Line(row)
if next.Y == previous.Y && next.Y == row && next.X < previous.X && previous.X-next.X <= 4 && len([]rune(next.Text(row))) < len([]rune(previous.Text(row))) {
// A shorter replacement prompt can also move the cursor left. Only
// echo removed text when the surrounding text matches a deletion.
if next.Y == previous.Y && next.Y == row && next.X < previous.X && previous.X-next.X <= 4 && len([]rune(next.Text(row))) < len([]rune(previous.Text(row))) &&
slices.Equal(before[:next.X], after[:next.X]) && strings.TrimRight(string(before[previous.X:]), " ") == strings.TrimRight(string(after[next.X:]), " ") {
removed := before[next.X:previous.X]
if len(removed) == 1 {
return []presentation.Message{presentation.Character_message(removed[0])}