Add a {\} marker to disable markup processing
This commit is contained in:
parent
fc9e0e8c6a
commit
2904d13420
|
@ -156,3 +156,14 @@ echo -markup 'default {Error}error{Default} default'
|
||||||
Inside a markup string, a literal `{` character is written `\{`, and a
|
Inside a markup string, a literal `{` character is written `\{`, and a
|
||||||
literal backslash (`\`) that precedes a '{' character is escaped as well
|
literal backslash (`\`) that precedes a '{' character is escaped as well
|
||||||
(`\\`).
|
(`\\`).
|
||||||
|
|
||||||
|
The `{\}` string disables markup processing for the rest of the line,
|
||||||
|
and can be used to avoid having to escape text that might be mistaken
|
||||||
|
for markup instructions.
|
||||||
|
|
||||||
|
For example this will prevent any '{' in the current buffer name from
|
||||||
|
being incorrectly interpreted as markup instructions.
|
||||||
|
|
||||||
|
----
|
||||||
|
echo -markup "{Information}name:{\} %val{bufname}"
|
||||||
|
----
|
||||||
|
|
|
@ -44,20 +44,20 @@ define-command -params ..1 \
|
||||||
/^!TAGROOT\t/ { tagroot=$2 }
|
/^!TAGROOT\t/ { tagroot=$2 }
|
||||||
/[^\t]+\t[^\t]+\t\/\^.*\$?\// {
|
/[^\t]+\t[^\t]+\t\/\^.*\$?\// {
|
||||||
line = $0; sub(".*\t/\\^", "", line); sub("\\$?/$", "", line);
|
line = $0; sub(".*\t/\\^", "", line); sub("\\$?/$", "", line);
|
||||||
menu_info = line; gsub("!", "!!", menu_info); gsub(/^[\t ]+/, "", menu_info); gsub("{", "\\{", menu_info); gsub(/\t/, " ", menu_info);
|
menu_info = line; gsub("!", "!!", menu_info); gsub(/^[\t ]+/, "", menu_info); gsub(/\t/, " ", menu_info);
|
||||||
keys = line; gsub(/</, "<lt>", keys); gsub(/\t/, "<c-v><c-i>", keys); gsub("!", "!!", keys); gsub("&", "&&", keys); gsub("#", "##", keys); gsub("\\|", "||", keys); gsub("\\\\/", "/", keys);
|
keys = line; gsub(/</, "<lt>", keys); gsub(/\t/, "<c-v><c-i>", keys); gsub("!", "!!", keys); gsub("&", "&&", keys); gsub("#", "##", keys); gsub("\\|", "||", keys); gsub("\\\\/", "/", keys);
|
||||||
menu_item = $2; gsub("!", "!!", menu_item);
|
menu_item = $2; gsub("!", "!!", menu_item);
|
||||||
edit_path = path($2); gsub("&", "&&", edit_path); gsub("#", "##", edit_path); gsub("\\|", "||", edit_path);
|
edit_path = path($2); gsub("&", "&&", edit_path); gsub("#", "##", edit_path); gsub("\\|", "||", edit_path);
|
||||||
select = $1; gsub(/</, "<lt>", select); gsub(/\t/, "<c-v><c-i>", select); gsub("!", "!!", select); gsub("&", "&&", select); gsub("#", "##", select); gsub("\\|", "||", select);
|
select = $1; gsub(/</, "<lt>", select); gsub(/\t/, "<c-v><c-i>", select); gsub("!", "!!", select); gsub("&", "&&", select); gsub("#", "##", select); gsub("\\|", "||", select);
|
||||||
out = out "%!" menu_item ": {MenuInfo}" menu_info "! %!evaluate-commands %# try %& edit -existing %|" edit_path "|; execute-keys %|/\\Q" keys "<ret>vc| & catch %& fail unable to find tag &; try %& execute-keys %|s\\Q" select "<ret>| & # !"
|
out = out "%!" menu_item ": {MenuInfo}{\\}" menu_info "! %!evaluate-commands %# try %& edit -existing %|" edit_path "|; execute-keys %|/\\Q" keys "<ret>vc| & catch %& fail unable to find tag &; try %& execute-keys %|s\\Q" select "<ret>| & # !"
|
||||||
}
|
}
|
||||||
/[^\t]+\t[^\t]+\t[0-9]+/ {
|
/[^\t]+\t[^\t]+\t[0-9]+/ {
|
||||||
menu_item = $2; gsub("!", "!!", menu_item);
|
menu_item = $2; gsub("!", "!!", menu_item);
|
||||||
select = $1; gsub(/</, "<lt>", select); gsub(/\t/, "<c-v><c-i>", select); gsub("!", "!!", select); gsub("&", "&&", select); gsub("#", "##", select); gsub("\\|", "||", select);
|
select = $1; gsub(/</, "<lt>", select); gsub(/\t/, "<c-v><c-i>", select); gsub("!", "!!", select); gsub("&", "&&", select); gsub("#", "##", select); gsub("\\|", "||", select);
|
||||||
menu_info = $3; gsub("!", "!!", menu_info); gsub("{", "\\{", menu_info);
|
menu_info = $3; gsub("!", "!!", menu_info);
|
||||||
edit_path = path($2); gsub("!", "!!", edit_path); gsub("#", "##", edit_path); gsub("&", "&&", edit_path); gsub("\\|", "||", edit_path);
|
edit_path = path($2); gsub("!", "!!", edit_path); gsub("#", "##", edit_path); gsub("&", "&&", edit_path); gsub("\\|", "||", edit_path);
|
||||||
line_number = $3;
|
line_number = $3;
|
||||||
out = out "%!" menu_item ": {MenuInfo}" menu_info "! %!evaluate-commands %# try %& edit -existing %|" edit_path "|; execute-keys %|" line_number "gx| & catch %& fail unable to find tag &; try %& execute-keys %|s\\Q" select "<ret>| & # !"
|
out = out "%!" menu_item ": {MenuInfo}{\}" menu_info "! %!evaluate-commands %# try %& edit -existing %|" edit_path "|; execute-keys %|" line_number "gx| & catch %& fail unable to find tag &; try %& execute-keys %|s\\Q" select "<ret>| & # !"
|
||||||
}
|
}
|
||||||
END { print ( length(out) == 0 ? "fail no such tag " ENVIRON["tagname"] : "menu -markup -auto-single " out ) }
|
END { print ( length(out) == 0 ? "fail no such tag " ENVIRON["tagname"] : "menu -markup -auto-single " out ) }
|
||||||
# Ensure x is an absolute file path, by prepending with tagroot
|
# Ensure x is an absolute file path, by prepending with tagroot
|
||||||
|
|
|
@ -44,7 +44,7 @@ declare-option -docstring "name of the client in which all source code jumps wil
|
||||||
define-command -hidden make-open-error -params 4 %{
|
define-command -hidden make-open-error -params 4 %{
|
||||||
evaluate-commands -try-client %opt{jumpclient} %{
|
evaluate-commands -try-client %opt{jumpclient} %{
|
||||||
edit -existing "%arg{1}" %arg{2} %arg{3}
|
edit -existing "%arg{1}" %arg{2} %arg{3}
|
||||||
echo -markup "{Information}%arg{4}"
|
echo -markup "{Information}{\}%arg{4}"
|
||||||
try %{ focus }
|
try %{ focus }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,6 +280,11 @@ DisplayLine parse_display_line(StringView line, const FaceRegistry& faces, const
|
||||||
// closing is now at the first char of "}}", advance it to the second
|
// closing is now at the first char of "}}", advance it to the second
|
||||||
++closing;
|
++closing;
|
||||||
}
|
}
|
||||||
|
else if (closing == it+2 and *(it+1) == '\\')
|
||||||
|
{
|
||||||
|
pos = closing + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
face = faces[{it+1, closing}];
|
face = faces[{it+1, closing}];
|
||||||
it = closing;
|
it = closing;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user