Handle TERM="screen(-xxx)?.yyy(-zzz)?" as TERM="screen"

OBS-URL: https://build.opensuse.org/package/show/Base:System/readline?expand=0&rev=15
This commit is contained in:
Dr. Werner Fink 2019-08-16 10:08:37 +00:00 committed by Git OBS Bridge
parent bf37978e17
commit 8563237495
2 changed files with 46 additions and 14 deletions

View File

@ -1,24 +1,49 @@
Special for screen and its new TERM setting like TERM=screen.xterm-256color
Map all "screen(-xxx)?.yyy(-zzz)?" to "screen" as well as map "konsole(-xxx)?"
and "gnome(-xxx)?" to "xterm".
This helps to get /etc/inputrc work for most users.
---
readline-7.0/bind.c | 9 +++++++++
1 file changed, 9 insertions(+)
lib/readline/bind.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
--- lib/readline/bind.c
+++ readline-7.0/bind.c 2018-09-28 11:22:31.001503017 +0000
@@ -1209,6 +1209,15 @@ parser_if (args)
+++ lib/readline/bind.c 2019-08-16 08:26:42.327029248 +0000
@@ -1195,19 +1195,34 @@ parser_if (char *args)
word in ARGS is the same as the value stored in rl_readline_name. */
if (rl_terminal_name && _rl_strnicmp (args, "term=", 5) == 0)
{
- char *tem, *tname;
+ char *tem, *tname, *talias;
- /* Terminals like "aaa-60" are equivalent to "aaa". */
tname = savestring (rl_terminal_name);
+ /* Various terminal types of screen are equivalent to "screen" */
+ if (_rl_strnicmp (rl_terminal_name, "screen", 6) == 0)
+ {
+ tem = strchr (tname, '.');
+ if (tem)
+ *tem = '\0';
+ }
+ /* Terminals like "aaa-60" are equivalent to "aaa". */
tem = strchr (tname, '-');
if (tem)
*tem = '\0';
+ /* Map terminal types "konsole" and "gnome" to "xterm" nowadays */
+ talias = tname;
+ if (_rl_stricmp("konsole", tname) == 0)
+ talias = "xterm";
+ if (_rl_stricmp("gnome", tname) == 0)
+ talias = "xterm";
+
/* Test the `long' and `short' forms of the terminal name so that
if someone has a `sun-cmd' and does not want to have bindings
that will be executed if the terminal is a `sun', they can put
`$if term=sun-cmd' into their .inputrc. */
_rl_parsing_conditionalized_out = _rl_stricmp (args + 5, tname) &&
+ _rl_stricmp (args + 5, talias) &&
_rl_stricmp (args + 5, rl_terminal_name);
+
+ /* Skip the prefix `screen.' if any to use the underlying bindings */
+ if (_rl_parsing_conditionalized_out &&
+ _rl_strnicmp (rl_terminal_name, "screen.", 7) == 0)
+ {
+ _rl_parsing_conditionalized_out = _rl_stricmp (args + 5, tname + 7) &&
+ _rl_stricmp (args + 5, rl_terminal_name + 7);
+ }
+
xfree (tname);
}
#if defined (VI_MODE)

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Aug 16 10:05:11 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Rework patch readline-7.0-screen.patch again for bug boo#1143055
* Map all "screen(-xxx)?.yyy(-zzz)?" to "screen" as well as
map "konsole(-xxx)?" and "gnome(-xxx)?" to "xterm"
-------------------------------------------------------------------
Thu Aug 15 13:45:15 UTC 2019 - Dr. Werner Fink <werner@suse.de>