Restore reading backspace if typing with autoread disabled.
This commit is contained in:
1 parent
eaf450587c
commit
57799cd2eb
6 files changed
+295
-6
No files matched your search
@@ -41,10 +41,11 @@ func (r *Reader) Note_deletion() { r.progressDeletionAt = time.Now() }
|
||||
|
||||
// A recent deletion key alone is insufficient: match the actual cursor-row
|
||||
// deletion so background progress, including another row in the same snapshot,
|
||||
// remains available to the detector. Automatic deletion speech is unchanged.
|
||||
func (r *Reader) progress_deletion_row(previous, next screen.Snapshot) int {
|
||||
// remains available to the detector. The same evidence permits deletion echo
|
||||
// while automatic reading is disabled, without speaking other screen changes.
|
||||
func (r *Reader) match_deletion(previous, next screen.Snapshot) []rune {
|
||||
if r.progressDeletionAt.IsZero() || time.Since(r.progressDeletionAt) > echoWindow || previous.Y != next.Y || next.X > previous.X {
|
||||
return -1
|
||||
return nil
|
||||
}
|
||||
before, after := previous.Line(next.Y), next.Line(next.Y)
|
||||
count := previous.X - next.X
|
||||
@@ -61,8 +62,8 @@ func (r *Reader) progress_deletion_row(previous, next screen.Snapshot) int {
|
||||
}
|
||||
if count <= 0 || next.X+count > next.Cols || !slices.Equal(before[:next.X], after[:next.X]) ||
|
||||
!slices.Equal(before[next.X+count:], after[next.X:next.Cols-count]) || !all_spaces(after[next.Cols-count:]) {
|
||||
return -1
|
||||
return nil
|
||||
}
|
||||
r.progressDeletionAt = time.Time{}
|
||||
return next.Y
|
||||
return before[next.X : next.X+count]
|
||||
}
|
||||
Reference in new issue
Block a user