[BRLTTY] Feature request: configurable prompt pattern

Aura Kelloniemi kaura.dev at sange.fi
Wed Mar 14 04:54:38 EDT 2018


Hi

Nicolas Pitre <nico at fluxnic.net> writes:
 > On Tue, 13 Mar 2018, Dave Mielke wrote:
 > > I completely understand your reason and the convenience. I'm just not convinced 
 > > that it'd actually work all that well as a general facility for the 
 > > inexperienced.

 > But the inexperienced wouldn't have to do anything if the default 
 > mimics the current behavior, no?

 > However such a feature i.e. the ability to modify what NXPROMPT matches, 
 > could be very useful to those who are experienced enough to tweak their 
 > prompt.

 > I think this would be a worthwhile feature if the default preserves 
 > existing functionality for those who don't care about the extra 
 > flexibility.


I consider the current behaviour to be a little bit of a hack itself. I
consider it to be a big limitation that in order to be able to move from one
prompt to another I have to first position the braille window on a line which
already has a prompt. Another big limitation is that I can't move between two
different types of prompts.

I would prefer to have PRPROMPT/NXPROMPT commands which are totally
context-insensitive - i.e. regex-match based. I suggest here two alternative
implementations:

First proposal - add prompt-pattern configuration option: This option is a
string, which is a regular expression pattern. NXPROMPT and PRPROMPT commands
move the window down and up respectively until the contents of the line on
which the window is matches this regular expression. THe expression can be
arbitrarily complex, and because regex supports alternatives, it can easily
recognize many different types of prompts. Here is an example, which matches a
normal [user at host dir]$ shell prompt in addition to python, gdb and irb.
"^\[[^ ]+@[^ ]+ [^]]+\][$#] |^>>>|^\.\.\.|^\(gdb\) |^irb\([^)]+\):\d+:\d+. "

If prompt-pattern was not defined or was set to a specific value (e.g. empty
string), then BRLTTY's current context-sensitive behaviour would be invoked
instead of pattern matching.

Second proposal - add new matching commands: Don't modify NXPROMPT or PROMPT
commands. Instead add NXMATCH and PRMATCH commands which match a regex pattern
in a way described in the previous section. This command would use a pattern
defined in brltty.conf with default-pattern option. There could be additional
commands for modifying this pattern - e.g. SETPATTERN (which sets the pattern
from the current contents of clipboard), RESETPATTERN (which resets it back to
the default value) and CLIP_PATTERN (which would copy the pattern to
clipboarrd for pasting and editing it).

These NXMATCH and PRMATCH commands could be unbound by default, so that they
are really available to power users only.

I'm actually up for the second proposal, because it would allow me to
dynamically change the pattern.

-- 
Aura


More information about the BRLTTY mailing list