[BRLTTY] Feature request: configurable prompt pattern

Nicolas Pitre nico at fluxnic.net
Wed Mar 14 11:10:12 EDT 2018


On Wed, 14 Mar 2018, Dave Mielke wrote:

> [quoted lines by Nicolas Pitre on 2018/03/13 at 22:10 -0400]
> 
> >But the inexperienced wouldn't have to do anything if the default 
> >mimics the current behavior, no?
> 
> Yes, for sure.
> 
> >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.
> 
> Yes. I think my issue is with the complexity of overriding the default. I'd 
> still like that, if possible, to be simple enough to be usable by more peolpe 
> than just the super experienced.

With great power comes great responsibility (or complexity).
When it is too simple, it is usually not all that useful either.

The optimal solution as mentioned already would be:

prompt_match = |<regexp1>|<regexp2>|

where <regexp1> is applied to the current line to produce <regexp2> 
which is then used to find a matching line. The default to preserve 
current behavior would then be:

prompt_match = |^([^ ]+ ).*|^\1|

But someone not acquainted with regexp still can use it simply, e.g.:

prompt_match = ||^my_custom_prompt: |

And to make things simpler, you could make the initial ^ implicit so the 
trivial form becomes:

prompt_match = ||my_custom_prompt: |

And the implicit ^ can be overridden with .* at the beginning for those 
advanced users who might want special prompt tracking located in the 
middle of the screen, so no flexibility is lost.

Here I used | as a separator, but any character should be usable just 
like with sed.


Nicolas


More information about the BRLTTY mailing list