summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/readline/readline-6.2/readline-only-enable-meta-key-for-a-single-call-read.patch114
-rw-r--r--meta/recipes-core/readline/readline_6.2.bb1
2 files changed, 115 insertions, 0 deletions
diff --git a/meta/recipes-core/readline/readline-6.2/readline-only-enable-meta-key-for-a-single-call-read.patch b/meta/recipes-core/readline/readline-6.2/readline-only-enable-meta-key-for-a-single-call-read.patch
new file mode 100644
index 0000000000..ccfdb9f8c9
--- /dev/null
+++ b/meta/recipes-core/readline/readline-6.2/readline-only-enable-meta-key-for-a-single-call-read.patch
@@ -0,0 +1,114 @@
1readline: only enable meta key for a single call readline().
2
3terminal.c
4 - change _rl_enable_meta_key to set a flag indicating that it sent the
5 enable-meta sequence
6 - _rl_disable_meta_key: new function to turn off meta mode after we
7 turned it on with _rl_enable_meta_key
8
9rlprivate.h
10 - extern declaration for _rl_disable_meta_key
11
12readline.c
13- _rl_internal_teardown: add call to _rl_disable_meta_key to make the
14 meta key active only for the duration of the call to readline()
15- _rl_internal_setup: move call to _rl_enable_meta_key here from
16 readline_initialize_everything so the meta key is active only for
17 the duration of the call to readline(). Suggestion from Miroslav
18 Lichvar <mlichvar@redhat.com>
19
20Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
21Upstream-Status: backport
22Imported patch from: http://git.savannah.gnu.org/cgit/bash.git/tag/?id=bash-4.3-alpha
23---
24 readline.c | 12 ++++++++----
25 rlprivate.h | 1 +
26 terminal.c | 19 ++++++++++++++++++-
27 3 files changed, 27 insertions(+), 5 deletions(-)
28
29diff --git a/readline.c b/readline.c
30--- a/readline.c
31+++ b/readline.c
32@@ -369,6 +369,11 @@ readline_internal_setup ()
33 _rl_in_stream = rl_instream;
34 _rl_out_stream = rl_outstream;
35
36+ /* Enable the meta key only for the duration of readline(), if this
37+ terminal has one. */
38+ if (_rl_enable_meta)
39+ _rl_enable_meta_key ();
40+
41 if (rl_startup_hook)
42 (*rl_startup_hook) ();
43
44@@ -437,6 +442,9 @@ readline_internal_teardown (eof)
45 if (rl_undo_list)
46 rl_free_undo_list ();
47
48+ /* Disable the meta key, if this terminal has one. */
49+ _rl_disable_meta_key ();
50+
51 /* Restore normal cursor, if available. */
52 _rl_set_insert_mode (RL_IM_INSERT, 0);
53
54@@ -1091,10 +1099,6 @@ readline_initialize_everything ()
55 /* Try to bind a common arrow key prefix, if not already bound. */
56 bind_arrow_keys ();
57
58- /* Enable the meta key, if this terminal has one. */
59- if (_rl_enable_meta)
60- _rl_enable_meta_key ();
61-
62 /* If the completion parser's default word break characters haven't
63 been set yet, then do so now. */
64 if (rl_completer_word_break_characters == (char *)NULL)
65diff --git a/rlprivate.h b/rlprivate.h
66index 384ff67..be2c2c6 100644
67--- a/rlprivate.h
68+++ b/rlprivate.h
69@@ -339,6 +339,7 @@ extern int _rl_output_character_function PARAMS((int));
70 extern void _rl_output_some_chars PARAMS((const char *, int));
71 extern int _rl_backspace PARAMS((int));
72 extern void _rl_enable_meta_key PARAMS((void));
73+extern void _rl_disable_meta_key PARAMS((void));
74 extern void _rl_control_keypad PARAMS((int));
75 extern void _rl_set_cursor PARAMS((int, int));
76
77diff --git a/terminal.c b/terminal.c
78index f8c2f6e..21ee031 100644
79--- a/terminal.c
80+++ b/terminal.c
81@@ -683,12 +683,29 @@ rl_ding ()
82 /* */
83 /* **************************************************************** */
84
85+static int enabled_meta = 0; /* flag indicating we enabled meta mode */
86+
87 void
88 _rl_enable_meta_key ()
89 {
90 #if !defined (__DJGPP__)
91 if (term_has_meta && _rl_term_mm)
92- tputs (_rl_term_mm, 1, _rl_output_character_function);
93+ {
94+ tputs (_rl_term_mm, 1, _rl_output_character_function);
95+ enabled_meta = 1;
96+ }
97+#endif
98+}
99+
100+void
101+_rl_disable_meta_key ()
102+{
103+#if !defined (__DJGPP__)
104+ if (term_has_meta && _rl_term_mo && enabled_meta)
105+ {
106+ tputs (_rl_term_mo, 1, _rl_output_character_function);
107+ enabled_meta = 0;
108+ }
109 #endif
110 }
111
112--
1131.8.1.2
114
diff --git a/meta/recipes-core/readline/readline_6.2.bb b/meta/recipes-core/readline/readline_6.2.bb
index 45fa4e7f3e..87636da4e3 100644
--- a/meta/recipes-core/readline/readline_6.2.bb
+++ b/meta/recipes-core/readline/readline_6.2.bb
@@ -6,6 +6,7 @@ SRC_URI += "${GNU_MIRROR}/readline/readline-6.2-patches/readline62-001;name=patc
6${GNU_MIRROR}/readline/readline-6.2-patches/readline62-002;name=patch2;apply=yes;striplevel=0 \ 6${GNU_MIRROR}/readline/readline-6.2-patches/readline62-002;name=patch2;apply=yes;striplevel=0 \
7${GNU_MIRROR}/readline/readline-6.2-patches/readline62-003;name=patch3;apply=yes;striplevel=0 \ 7${GNU_MIRROR}/readline/readline-6.2-patches/readline62-003;name=patch3;apply=yes;striplevel=0 \
8${GNU_MIRROR}/readline/readline-6.2-patches/readline62-004;name=patch4;apply=yes;striplevel=0 \ 8${GNU_MIRROR}/readline/readline-6.2-patches/readline62-004;name=patch4;apply=yes;striplevel=0 \
9file://readline-only-enable-meta-key-for-a-single-call-read.patch \
9" 10"
10 11
11SRC_URI[archive.md5sum] = "67948acb2ca081f23359d0256e9a271c" 12SRC_URI[archive.md5sum] = "67948acb2ca081f23359d0256e9a271c"