Finally! Fixed bug that was causing interruption when prompt comes back.
This commit is contained in:
@@ -71,6 +71,13 @@ class command:
|
||||
self.env["screen"]["new_cursor"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
# Don't interrupt ongoing auto-read announcements
|
||||
do_interrupt = True
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"speech", "auto_read_incoming"
|
||||
):
|
||||
do_interrupt = False
|
||||
|
||||
if curr_char.isspace():
|
||||
# Only announce spaces during pure navigation (arrow keys)
|
||||
# Check if this is really navigation by looking at input history
|
||||
@@ -87,14 +94,14 @@ class command:
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
curr_char,
|
||||
interrupt=True,
|
||||
interrupt=do_interrupt,
|
||||
announce_capital=True,
|
||||
flush=False,
|
||||
)
|
||||
else:
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_char,
|
||||
interrupt=True,
|
||||
interrupt=do_interrupt,
|
||||
ignore_punctuation=True,
|
||||
announce_capital=True,
|
||||
flush=False,
|
||||
|
||||
@@ -152,11 +152,18 @@ class command:
|
||||
curr_delta = delta_text
|
||||
if (len(curr_delta.strip()) != len(curr_delta) and curr_delta.strip() != ""):
|
||||
curr_delta = curr_delta.strip()
|
||||
|
||||
|
||||
# Don't interrupt ongoing auto-read announcements
|
||||
do_interrupt = True
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"speech", "auto_read_incoming"
|
||||
):
|
||||
do_interrupt = False
|
||||
|
||||
# Enhanced announcement with better handling of empty completions
|
||||
if curr_delta:
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_delta, interrupt=True, announce_capital=True, flush=False
|
||||
curr_delta, interrupt=do_interrupt, announce_capital=True, flush=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
|
||||
@@ -66,8 +66,15 @@ class command:
|
||||
):
|
||||
return
|
||||
|
||||
# Don't interrupt ongoing auto-read announcements
|
||||
do_interrupt = True
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"speech", "auto_read_incoming"
|
||||
):
|
||||
do_interrupt = False
|
||||
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_word, interrupt=True, flush=False
|
||||
curr_word, interrupt=do_interrupt, flush=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
|
||||
@@ -30,8 +30,8 @@ class command:
|
||||
if self.env["runtime"]["ScreenManager"].is_screen_change():
|
||||
self.lastIdent = 0
|
||||
return
|
||||
# this leads to problems in vim -> status line change -> no
|
||||
# announcement, so we do check the lengh as hack
|
||||
# Don't announce cursor movements when auto-read is handling incoming text
|
||||
# This prevents interrupting ongoing auto-read announcements
|
||||
if self.env["runtime"]["ScreenManager"].is_delta():
|
||||
return
|
||||
|
||||
@@ -44,16 +44,22 @@ class command:
|
||||
self.env["screen"]["new_cursor"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
# Don't interrupt ongoing auto-read announcements with cursor movement
|
||||
do_interrupt = True
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"speech", "auto_read_incoming"
|
||||
):
|
||||
do_interrupt = False
|
||||
|
||||
if curr_line.isspace():
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True, flush=False
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=do_interrupt, flush=False
|
||||
)
|
||||
else:
|
||||
# ident
|
||||
curr_ident = len(curr_line) - len(curr_line.lstrip())
|
||||
if self.lastIdent == -1:
|
||||
self.lastIdent = curr_ident
|
||||
do_interrupt = True
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"general", "auto_present_indent"
|
||||
):
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import time
|
||||
|
||||
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return ""
|
||||
|
||||
def run(self):
|
||||
if not self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"speech", "auto_read_incoming"
|
||||
):
|
||||
return
|
||||
|
||||
if "pendingPromptText" not in self.env["commandBuffer"]:
|
||||
return
|
||||
|
||||
pending_text = self.env["commandBuffer"]["pendingPromptText"]
|
||||
if not pending_text:
|
||||
return
|
||||
|
||||
pending_time = self.env["commandBuffer"].get("pendingPromptTime", 0)
|
||||
delay = self.env["runtime"]["SettingsManager"].get_setting_as_float(
|
||||
"speech", "batch_flush_interval"
|
||||
)
|
||||
if time.time() - pending_time < delay:
|
||||
return
|
||||
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
pending_text, interrupt=False, flush=False
|
||||
)
|
||||
self.env["commandBuffer"]["pendingPromptText"] = ""
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
@@ -4,5 +4,5 @@
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
version = "2026.01.05"
|
||||
version = "2026.01.08"
|
||||
code_name = "testing"
|
||||
|
||||
Reference in New Issue
Block a user