1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
require 'formula'
class Readline < Formula
homepage 'http://tiswww.case.edu/php/chet/readline/rltop.html'
url 'http://ftpmirror.gnu.org/readline/readline-6.2.tar.gz'
mirror 'http://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz'
sha256 '79a696070a058c233c72dd6ac697021cc64abd5ed51e59db867d66d196a89381'
version '6.2.4'
keg_only <<-EOS
OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
EOS
# Vendor the patches.
# The mirrors are unreliable for getting the patches, and the more patches
# there are, the more unreliable they get. Pulling this patch inline to
# reduce bug reports.
# Upstream patches can be found in:
# http://ftpmirror.gnu.org/readline/readline-6.2-patches
def patches; DATA; end
def install
# Always build universal, per https://github.com/mxcl/homebrew/issues/issue/899
ENV.universal_binary
system "./configure", "--prefix=#{prefix}",
"--mandir=#{man}",
"--infodir=#{info}",
"--enable-multibyte"
system "make install"
end
end
__END__
diff --git a/callback.c b/callback.c
index 4ee6361..7682cd0 100644
--- a/callback.c
+++ b/callback.c
@@ -148,6 +148,9 @@ rl_callback_read_char ()
eof = _rl_vi_domove_callback (_rl_vimvcxt);
/* Should handle everything, including cleanup, numeric arguments,
and turning off RL_STATE_VIMOTION */
+ if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
+ _rl_internal_char_cleanup ();
+
return;
}
#endif
diff --git a/input.c b/input.c
index 7c74c99..b49af88 100644
--- a/input.c
+++ b/input.c
@@ -409,7 +409,7 @@ rl_clear_pending_input ()
int
rl_read_key ()
{
- int c;
+ int c, r;
rl_key_sequence_length++;
@@ -429,14 +429,18 @@ rl_read_key ()
{
while (rl_event_hook)
{
- if (rl_gather_tyi () < 0) /* XXX - EIO */
+ if (rl_get_char (&c) != 0)
+ break;
+
+ if ((r = rl_gather_tyi ()) < 0) /* XXX - EIO */
{
rl_done = 1;
return ('\n');
}
+ else if (r == 1) /* read something */
+ continue;
+
RL_CHECK_SIGNALS ();
- if (rl_get_char (&c) != 0)
- break;
if (rl_done) /* XXX - experimental */
return ('\n');
(*rl_event_hook) ();
diff --git a/patchlevel b/patchlevel
index fdf4740..626a945 100644
--- a/patchlevel
+++ b/patchlevel
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-1
+4
diff --git a/support/shobj-conf b/support/shobj-conf
index 5a63e80..c61dc78 100644
--- a/support/shobj-conf
+++ b/support/shobj-conf
@@ -157,7 +157,7 @@ freebsd[4-9]*|freebsdelf*|dragonfly*)
;;
# Darwin/MacOS X
-darwin[89]*|darwin10*)
+darwin[89]*|darwin1[012]*)
SHOBJ_STATUS=supported
SHLIB_STATUS=supported
@@ -186,7 +186,7 @@ darwin*|macosx*)
SHLIB_LIBSUFF='dylib'
case "${host_os}" in
- darwin[789]*|darwin10*) SHOBJ_LDFLAGS=''
+ darwin[789]*|darwin1[012]*) SHOBJ_LDFLAGS=''
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
;;
*) SHOBJ_LDFLAGS='-dynamic'
diff --git a/vi_mode.c b/vi_mode.c
index 41e1dbb..4408053 100644
--- a/vi_mode.c
+++ b/vi_mode.c
@@ -1114,7 +1114,7 @@ rl_domove_read_callback (m)
rl_beg_of_line (1, c);
_rl_vi_last_motion = c;
RL_UNSETSTATE (RL_STATE_VIMOTION);
- return (0);
+ return (vidomove_dispatch (m));
}
#if defined (READLINE_CALLBACKS)
/* XXX - these need to handle rl_universal_argument bindings */
@@ -1234,11 +1234,19 @@ rl_vi_delete_to (count, key)
_rl_vimvcxt->motion = '$';
r = rl_domove_motion_callback (_rl_vimvcxt);
}
- else if (vi_redoing)
+ else if (vi_redoing && _rl_vi_last_motion != 'd') /* `dd' is special */
{
_rl_vimvcxt->motion = _rl_vi_last_motion;
r = rl_domove_motion_callback (_rl_vimvcxt);
}
+ else if (vi_redoing) /* handle redoing `dd' here */
+ {
+ _rl_vimvcxt->motion = _rl_vi_last_motion;
+ rl_mark = rl_end;
+ rl_beg_of_line (1, key);
+ RL_UNSETSTATE (RL_STATE_VIMOTION);
+ r = vidomove_dispatch (_rl_vimvcxt);
+ }
#if defined (READLINE_CALLBACKS)
else if (RL_ISSTATE (RL_STATE_CALLBACK))
{
@@ -1316,11 +1324,19 @@ rl_vi_change_to (count, key)
_rl_vimvcxt->motion = '$';
r = rl_domove_motion_callback (_rl_vimvcxt);
}
- else if (vi_redoing)
+ else if (vi_redoing && _rl_vi_last_motion != 'c') /* `cc' is special */
{
_rl_vimvcxt->motion = _rl_vi_last_motion;
r = rl_domove_motion_callback (_rl_vimvcxt);
}
+ else if (vi_redoing) /* handle redoing `cc' here */
+ {
+ _rl_vimvcxt->motion = _rl_vi_last_motion;
+ rl_mark = rl_end;
+ rl_beg_of_line (1, key);
+ RL_UNSETSTATE (RL_STATE_VIMOTION);
+ r = vidomove_dispatch (_rl_vimvcxt);
+ }
#if defined (READLINE_CALLBACKS)
else if (RL_ISSTATE (RL_STATE_CALLBACK))
{
@@ -1377,6 +1393,19 @@ rl_vi_yank_to (count, key)
_rl_vimvcxt->motion = '$';
r = rl_domove_motion_callback (_rl_vimvcxt);
}
+ else if (vi_redoing && _rl_vi_last_motion != 'y') /* `yy' is special */
+ {
+ _rl_vimvcxt->motion = _rl_vi_last_motion;
+ r = rl_domove_motion_callback (_rl_vimvcxt);
+ }
+ else if (vi_redoing) /* handle redoing `yy' here */
+ {
+ _rl_vimvcxt->motion = _rl_vi_last_motion;
+ rl_mark = rl_end;
+ rl_beg_of_line (1, key);
+ RL_UNSETSTATE (RL_STATE_VIMOTION);
+ r = vidomove_dispatch (_rl_vimvcxt);
+ }
#if defined (READLINE_CALLBACKS)
else if (RL_ISSTATE (RL_STATE_CALLBACK))
{
|