Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Once in the config menu, you can use:
* v - set volume (value between 0 and 100).
* p - toggle symbol processing.
* d - set cursor delay (in MS). The default is 20.
* e - toggle character echo
* w - toggle word echo
* c - toggle cursor following
* Enter - exit, saving the configuration.

## Symbols
Expand Down
15 changes: 14 additions & 1 deletion tdsr
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class State:
self.tempsilence = False
self.key_handlers = []
self.config = configparser.ConfigParser()
self.config['speech'] = {'process_symbols': 'false', 'key_echo': True, 'cursor_tracking': True}
self.config['speech'] = {'process_symbols': 'false', 'key_echo': True, 'cursor_tracking': True, 'word_echo': True}
self.config['symbols'] = {}
self.symbols_Re = None
self.copy_x = None
Expand Down Expand Up @@ -109,6 +109,7 @@ class ConfigHandler(KeyHandler):
b'p': self.set_process_symbols,
b'd': self.set_delay,
b'e': self.set_echo,
b'w': self.set_word_echo,
b'c': self.set_cursor_tracking,
}
super().__init__(self.keymap)
Expand Down Expand Up @@ -157,6 +158,12 @@ class ConfigHandler(KeyHandler):
state.save_config()
say("character echo on" if current else "character echo off")

def set_word_echo(self):
current = state.config.getboolean('speech', 'word_echo', fallback=True)
current = not current
state.config['speech']['word_echo'] = str(current)
say("word echo " + ("on" if current else "off"))

def set_cursor_tracking(self):
current = state.config.getboolean('speech', 'cursor_tracking', fallback=True)
current = not current
Expand Down Expand Up @@ -743,7 +750,13 @@ def resize_terminal(fd):
def handle_sigwinch(*args):
os.write(signal_pipe[1], b'w')

def handle_space(*args):
if state.config.getboolean('speech', 'word_echo'):
prevword()
return KeyHandler.PASSTHROUGH

keymap = {
b' ': handle_space,
b'\x1bi': lambda: sayline(state.revy),
b'\x1bu': prevline,
b'\x1bo': nextline,
Expand Down