Fix for repeating in some instances, e.g. pidgin.

This commit is contained in:
Storm Dragon committed 2026-10-27 19:40:17 -04:00
1 parent 4d29f2bb23
commit b232c1eebb
20 files changed
+921 -7

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
// Copyright (c) 2026 Storm Dragon
// Authors: Storm Dragon, Angus Kola
// SPDX-License-Identifier: GPL-3.0-or-later
package app
import (
"git.stormux.org/storm/cthulhu/internal/atspi"
"git.stormux.org/storm/cthulhu/internal/input"
)
// A submission can clear an entry before its message appears in a transcript.
// Do not mistake that clear for an editing command. Unknown input/caret data,
// other controls and selected-text replacement keep their existing feedback.
func (state *eventLoopState) submitted_text_clear(event atspi.Event, activity input.Activity) bool {
source := event.Source
if event.Type != atspi.TextDeletedEvent || event.Payload == "" || event.Detail1 != 0 ||
!activity.PlainEnter || activity.Sequence == 0 || !atspi.IsEchoEditField(source) ||
(source.Role != "text" && source.Role != "entry") || source.Autocomplete || source.LiveRegion ||
source.ID() != state.focusedID || !source.TextCaretKnown || source.BrailleCaret != 0 ||
source.BrailleLineStart != 0 || source.Text != "" || source.TextBeforeCaret != "" || source.BrailleLine != "" ||
source.SelectionEnd > source.SelectionStart {
return false
}
if state.selection.id == source.ID() && state.selection.end > state.selection.start {
return false
}
// Some providers report selection removal before the deletion itself.
return state.selectionCaretID != source.ID() || state.selectionCaretSequence != activity.Sequence
}