From 8d3d51a020b02d6f9d87272bfc6b56fdff468649 Mon Sep 17 00:00:00 2001 From: Mark Griffiths Date: Tue, 23 Sep 2014 05:18:16 +0100 Subject: [PATCH] lexicon_filter fix for escaped options Fixes #1703. Also fixes short and long options markup in synopsis when directly following a '(' or '[' character. --- doc_src/bind.txt | 2 +- lexicon_filter.in | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/doc_src/bind.txt b/doc_src/bind.txt index 599a1ec3a..5e5c90f18 100644 --- a/doc_src/bind.txt +++ b/doc_src/bind.txt @@ -120,6 +120,6 @@ Performs a history search when the @key{Page Up} key is pressed. \fish set -g fish_key_bindings fish_vi_key_bindings -bind -M insert @args{@bksl{cc}} kill-whole-line force-repaint +bind -M insert \cc kill-whole-line force-repaint \endfish Turns on Vi key bindings and rebinds @key{Control,C} to clear the input line. diff --git a/lexicon_filter.in b/lexicon_filter.in index 0f2a0e1ae..4ee5f7cc3 100644 --- a/lexicon_filter.in +++ b/lexicon_filter.in @@ -188,14 +188,14 @@ s/@sgst{\([^}]*\)}/\\\ #. # Command/Function options # Short options -s/ -\([A-Za-z][A-Za-z]*\)\([^A-Za-z}]\)/ \\\ -<@opts{-\1}\ -\2/g +s/\([[( ]\)-\([A-Za-z][A-Za-z]*\)\([^A-Za-z}]\)/\1\\\ +<@opts{-\2}\ +\3/g #. # Long options -s/ --\([A-Za-z][A-Za-z0-9=_-]*\)\([^A-Za-z0-9=_-]*\)/ \\\ -<@opts{--\1}\ -\2/g +s/\([[( ]\)--\([A-Za-z][A-Za-z0-9=_-]*\)\([^A-Za-z0-9=_-]*\)/\1\\\ +<@opts{--\2}\ +\3/g #. # Prompt s/~>_/\\\ @@ -211,6 +211,9 @@ s/___\(.\)/\\\ <@curs{\1}\ / #. +# Escaped Options +s/ \\\([A-Za-z0-9][A-Za-z0-9]*\) / @bksl{\1} /g +#. # Trailing Backslash s/ \\$/ @bksl{ }/ #. @@ -447,7 +450,10 @@ s/\( *@redr{|} *\)@bltn/\1@xbln/g s/^\( *\)@func/\1@xfnc/ s/\( *[;()] *\)@func/\1@xfnc/g s/\( *@redr{|} *\)@func/\1@xfnc/g -s/\\@bltn{\([^}]*\)/@args{@bksl{\1}/g +s/ @bksl{\([^}]*\)} / @args{@bksl{\1}} /g +s/ @bksl{@bltn{\([^}]*\)}/ @args{@bksl{\1}/g +s/ @bksl{@func{\([^}]*\)}/ @args{@bksl{\1}/g +s/ @bksl{@cmnd{\([^}]*\)}/ @args{@bksl{\1}/g s/@bltn/@args/g s/@func/@args/g s/@cmnd/@args/g