mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
IRB is improved with Reline and RDoc
Reline is a readline stdlib compatible library. It also supports multiline input. IRB is improved with Reline and supports multiline. Besides, supports showing documents when completed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
91faab7f14
commit
7f273ac6d0
34 changed files with 8183 additions and 1119 deletions
518
lib/reline/key_actor/emacs.rb
Normal file
518
lib/reline/key_actor/emacs.rb
Normal file
|
@ -0,0 +1,518 @@
|
|||
class Reline::KeyActor::Emacs < Reline::KeyActor::Base
|
||||
MAPPING = [
|
||||
# 0 ^@
|
||||
:em_set_mark,
|
||||
# 1 ^A
|
||||
:ed_move_to_beg,
|
||||
# 2 ^B
|
||||
:ed_prev_char,
|
||||
# 3 ^C
|
||||
:ed_ignore,
|
||||
# 4 ^D
|
||||
:em_delete_or_list,
|
||||
# 5 ^E
|
||||
:ed_move_to_end,
|
||||
# 6 ^F
|
||||
:ed_next_char,
|
||||
# 7 ^G
|
||||
:ed_unassigned,
|
||||
# 8 ^H
|
||||
:em_delete_prev_char,
|
||||
# 9 ^I
|
||||
:ed_unassigned,
|
||||
# 10 ^J
|
||||
:ed_newline,
|
||||
# 11 ^K
|
||||
:ed_kill_line,
|
||||
# 12 ^L
|
||||
:ed_clear_screen,
|
||||
# 13 ^M
|
||||
:ed_newline,
|
||||
# 14 ^N
|
||||
:ed_next_history,
|
||||
# 15 ^O
|
||||
:ed_ignore,
|
||||
# 16 ^P
|
||||
:ed_prev_history,
|
||||
# 17 ^Q
|
||||
:ed_ignore,
|
||||
# 18 ^R
|
||||
:ed_redisplay,
|
||||
# 19 ^S
|
||||
:ed_ignore,
|
||||
# 20 ^T
|
||||
:ed_transpose_chars,
|
||||
# 21 ^U
|
||||
:em_kill_line,
|
||||
# 22 ^V
|
||||
:ed_quoted_insert,
|
||||
# 23 ^W
|
||||
:em_kill_region,
|
||||
# 24 ^X
|
||||
:ed_sequence_lead_in,
|
||||
# 25 ^Y
|
||||
:em_yank,
|
||||
# 26 ^Z
|
||||
:ed_ignore,
|
||||
# 27 ^[
|
||||
:em_meta_next,
|
||||
# 28 ^\
|
||||
:ed_ignore,
|
||||
# 29 ^]
|
||||
:ed_ignore,
|
||||
# 30 ^^
|
||||
:ed_unassigned,
|
||||
# 31 ^_
|
||||
:ed_unassigned,
|
||||
# 32 SPACE
|
||||
:ed_insert,
|
||||
# 33 !
|
||||
:ed_insert,
|
||||
# 34 "
|
||||
:ed_insert,
|
||||
# 35 #
|
||||
:ed_insert,
|
||||
# 36 $
|
||||
:ed_insert,
|
||||
# 37 %
|
||||
:ed_insert,
|
||||
# 38 &
|
||||
:ed_insert,
|
||||
# 39 '
|
||||
:ed_insert,
|
||||
# 40 (
|
||||
:ed_insert,
|
||||
# 41 )
|
||||
:ed_insert,
|
||||
# 42 *
|
||||
:ed_insert,
|
||||
# 43 +
|
||||
:ed_insert,
|
||||
# 44 ,
|
||||
:ed_insert,
|
||||
# 45 -
|
||||
:ed_insert,
|
||||
# 46 .
|
||||
:ed_insert,
|
||||
# 47 /
|
||||
:ed_insert,
|
||||
# 48 0
|
||||
:ed_digit,
|
||||
# 49 1
|
||||
:ed_digit,
|
||||
# 50 2
|
||||
:ed_digit,
|
||||
# 51 3
|
||||
:ed_digit,
|
||||
# 52 4
|
||||
:ed_digit,
|
||||
# 53 5
|
||||
:ed_digit,
|
||||
# 54 6
|
||||
:ed_digit,
|
||||
# 55 7
|
||||
:ed_digit,
|
||||
# 56 8
|
||||
:ed_digit,
|
||||
# 57 9
|
||||
:ed_digit,
|
||||
# 58 :
|
||||
:ed_insert,
|
||||
# 59 ;
|
||||
:ed_insert,
|
||||
# 60 <
|
||||
:ed_insert,
|
||||
# 61 =
|
||||
:ed_insert,
|
||||
# 62 >
|
||||
:ed_insert,
|
||||
# 63 ?
|
||||
:ed_insert,
|
||||
# 64 @
|
||||
:ed_insert,
|
||||
# 65 A
|
||||
:ed_insert,
|
||||
# 66 B
|
||||
:ed_insert,
|
||||
# 67 C
|
||||
:ed_insert,
|
||||
# 68 D
|
||||
:ed_insert,
|
||||
# 69 E
|
||||
:ed_insert,
|
||||
# 70 F
|
||||
:ed_insert,
|
||||
# 71 G
|
||||
:ed_insert,
|
||||
# 72 H
|
||||
:ed_insert,
|
||||
# 73 I
|
||||
:ed_insert,
|
||||
# 74 J
|
||||
:ed_insert,
|
||||
# 75 K
|
||||
:ed_insert,
|
||||
# 76 L
|
||||
:ed_insert,
|
||||
# 77 M
|
||||
:ed_insert,
|
||||
# 78 N
|
||||
:ed_insert,
|
||||
# 79 O
|
||||
:ed_insert,
|
||||
# 80 P
|
||||
:ed_insert,
|
||||
# 81 Q
|
||||
:ed_insert,
|
||||
# 82 R
|
||||
:ed_insert,
|
||||
# 83 S
|
||||
:ed_insert,
|
||||
# 84 T
|
||||
:ed_insert,
|
||||
# 85 U
|
||||
:ed_insert,
|
||||
# 86 V
|
||||
:ed_insert,
|
||||
# 87 W
|
||||
:ed_insert,
|
||||
# 88 X
|
||||
:ed_insert,
|
||||
# 89 Y
|
||||
:ed_insert,
|
||||
# 90 Z
|
||||
:ed_insert,
|
||||
# 91 [
|
||||
:ed_insert,
|
||||
# 92 \
|
||||
:ed_insert,
|
||||
# 93 ]
|
||||
:ed_insert,
|
||||
# 94 ^
|
||||
:ed_insert,
|
||||
# 95 _
|
||||
:ed_insert,
|
||||
# 96 `
|
||||
:ed_insert,
|
||||
# 97 a
|
||||
:ed_insert,
|
||||
# 98 b
|
||||
:ed_insert,
|
||||
# 99 c
|
||||
:ed_insert,
|
||||
# 100 d
|
||||
:ed_insert,
|
||||
# 101 e
|
||||
:ed_insert,
|
||||
# 102 f
|
||||
:ed_insert,
|
||||
# 103 g
|
||||
:ed_insert,
|
||||
# 104 h
|
||||
:ed_insert,
|
||||
# 105 i
|
||||
:ed_insert,
|
||||
# 106 j
|
||||
:ed_insert,
|
||||
# 107 k
|
||||
:ed_insert,
|
||||
# 108 l
|
||||
:ed_insert,
|
||||
# 109 m
|
||||
:ed_insert,
|
||||
# 110 n
|
||||
:ed_insert,
|
||||
# 111 o
|
||||
:ed_insert,
|
||||
# 112 p
|
||||
:ed_insert,
|
||||
# 113 q
|
||||
:ed_insert,
|
||||
# 114 r
|
||||
:ed_insert,
|
||||
# 115 s
|
||||
:ed_insert,
|
||||
# 116 t
|
||||
:ed_insert,
|
||||
# 117 u
|
||||
:ed_insert,
|
||||
# 118 v
|
||||
:ed_insert,
|
||||
# 119 w
|
||||
:ed_insert,
|
||||
# 120 x
|
||||
:ed_insert,
|
||||
# 121 y
|
||||
:ed_insert,
|
||||
# 122 z
|
||||
:ed_insert,
|
||||
# 123 {
|
||||
:ed_insert,
|
||||
# 124 |
|
||||
:ed_insert,
|
||||
# 125 }
|
||||
:ed_insert,
|
||||
# 126 ~
|
||||
:ed_insert,
|
||||
# 127 ^?
|
||||
:em_delete_prev_char,
|
||||
# 128 M-^@
|
||||
:ed_unassigned,
|
||||
# 129 M-^A
|
||||
:ed_unassigned,
|
||||
# 130 M-^B
|
||||
:ed_unassigned,
|
||||
# 131 M-^C
|
||||
:ed_unassigned,
|
||||
# 132 M-^D
|
||||
:ed_unassigned,
|
||||
# 133 M-^E
|
||||
:ed_unassigned,
|
||||
# 134 M-^F
|
||||
:ed_unassigned,
|
||||
# 135 M-^G
|
||||
:ed_unassigned,
|
||||
# 136 M-^H
|
||||
:ed_delete_prev_word,
|
||||
# 137 M-^I
|
||||
:ed_unassigned,
|
||||
# 138 M-^J
|
||||
:ed_unassigned,
|
||||
# 139 M-^K
|
||||
:ed_unassigned,
|
||||
# 140 M-^L
|
||||
:ed_clear_screen,
|
||||
# 141 M-^M
|
||||
:ed_unassigned,
|
||||
# 142 M-^N
|
||||
:ed_unassigned,
|
||||
# 143 M-^O
|
||||
:ed_unassigned,
|
||||
# 144 M-^P
|
||||
:ed_unassigned,
|
||||
# 145 M-^Q
|
||||
:ed_unassigned,
|
||||
# 146 M-^R
|
||||
:ed_unassigned,
|
||||
# 147 M-^S
|
||||
:ed_unassigned,
|
||||
# 148 M-^T
|
||||
:ed_unassigned,
|
||||
# 149 M-^U
|
||||
:ed_unassigned,
|
||||
# 150 M-^V
|
||||
:ed_unassigned,
|
||||
# 151 M-^W
|
||||
:ed_unassigned,
|
||||
# 152 M-^X
|
||||
:ed_unassigned,
|
||||
# 153 M-^Y
|
||||
:ed_unassigned,
|
||||
# 154 M-^Z
|
||||
:ed_unassigned,
|
||||
# 155 M-^[
|
||||
:ed_unassigned,
|
||||
# 156 M-^\
|
||||
:ed_unassigned,
|
||||
# 157 M-^]
|
||||
:ed_unassigned,
|
||||
# 158 M-^^
|
||||
:ed_unassigned,
|
||||
# 159 M-^_
|
||||
:em_copy_prev_word,
|
||||
# 160 M-SPACE
|
||||
:ed_unassigned,
|
||||
# 161 M-!
|
||||
:ed_unassigned,
|
||||
# 162 M-"
|
||||
:ed_unassigned,
|
||||
# 163 M-#
|
||||
:ed_unassigned,
|
||||
# 164 M-$
|
||||
:ed_unassigned,
|
||||
# 165 M-%
|
||||
:ed_unassigned,
|
||||
# 166 M-&
|
||||
:ed_unassigned,
|
||||
# 167 M-'
|
||||
:ed_unassigned,
|
||||
# 168 M-(
|
||||
:ed_unassigned,
|
||||
# 169 M-)
|
||||
:ed_unassigned,
|
||||
# 170 M-*
|
||||
:ed_unassigned,
|
||||
# 171 M-+
|
||||
:ed_unassigned,
|
||||
# 172 M-,
|
||||
:ed_unassigned,
|
||||
# 173 M--
|
||||
:ed_unassigned,
|
||||
# 174 M-.
|
||||
:ed_unassigned,
|
||||
# 175 M-/
|
||||
:ed_unassigned,
|
||||
# 176 M-0
|
||||
:ed_argument_digit,
|
||||
# 177 M-1
|
||||
:ed_argument_digit,
|
||||
# 178 M-2
|
||||
:ed_argument_digit,
|
||||
# 179 M-3
|
||||
:ed_argument_digit,
|
||||
# 180 M-4
|
||||
:ed_argument_digit,
|
||||
# 181 M-5
|
||||
:ed_argument_digit,
|
||||
# 182 M-6
|
||||
:ed_argument_digit,
|
||||
# 183 M-7
|
||||
:ed_argument_digit,
|
||||
# 184 M-8
|
||||
:ed_argument_digit,
|
||||
# 185 M-9
|
||||
:ed_argument_digit,
|
||||
# 186 M-:
|
||||
:ed_unassigned,
|
||||
# 187 M-;
|
||||
:ed_unassigned,
|
||||
# 188 M-<
|
||||
:ed_unassigned,
|
||||
# 189 M-=
|
||||
:ed_unassigned,
|
||||
# 190 M->
|
||||
:ed_unassigned,
|
||||
# 191 M-?
|
||||
:ed_unassigned,
|
||||
# 192 M-@
|
||||
:ed_unassigned,
|
||||
# 193 M-A
|
||||
:ed_unassigned,
|
||||
# 194 M-B
|
||||
:ed_prev_word,
|
||||
# 195 M-C
|
||||
:em_capitol_case,
|
||||
# 196 M-D
|
||||
:em_delete_next_word,
|
||||
# 197 M-E
|
||||
:ed_unassigned,
|
||||
# 198 M-F
|
||||
:em_next_word,
|
||||
# 199 M-G
|
||||
:ed_unassigned,
|
||||
# 200 M-H
|
||||
:ed_unassigned,
|
||||
# 201 M-I
|
||||
:ed_unassigned,
|
||||
# 202 M-J
|
||||
:ed_unassigned,
|
||||
# 203 M-K
|
||||
:ed_unassigned,
|
||||
# 204 M-L
|
||||
:em_lower_case,
|
||||
# 205 M-M
|
||||
:ed_unassigned,
|
||||
# 206 M-N
|
||||
:ed_search_next_history,
|
||||
# 207 M-O
|
||||
:ed_sequence_lead_in,
|
||||
# 208 M-P
|
||||
:ed_search_prev_history,
|
||||
# 209 M-Q
|
||||
:ed_unassigned,
|
||||
# 210 M-R
|
||||
:ed_unassigned,
|
||||
# 211 M-S
|
||||
:ed_unassigned,
|
||||
# 212 M-T
|
||||
:ed_unassigned,
|
||||
# 213 M-U
|
||||
:em_upper_case,
|
||||
# 214 M-V
|
||||
:ed_unassigned,
|
||||
# 215 M-W
|
||||
:em_copy_region,
|
||||
# 216 M-X
|
||||
:ed_command,
|
||||
# 217 M-Y
|
||||
:ed_unassigned,
|
||||
# 218 M-Z
|
||||
:ed_unassigned,
|
||||
# 219 M-[
|
||||
:ed_sequence_lead_in,
|
||||
# 220 M-\
|
||||
:ed_unassigned,
|
||||
# 221 M-]
|
||||
:ed_unassigned,
|
||||
# 222 M-^
|
||||
:ed_unassigned,
|
||||
# 223 M-_
|
||||
:ed_unassigned,
|
||||
# 223 M-`
|
||||
:ed_unassigned,
|
||||
# 224 M-a
|
||||
:ed_unassigned,
|
||||
# 225 M-b
|
||||
:ed_prev_word,
|
||||
# 226 M-c
|
||||
:em_capitol_case,
|
||||
# 227 M-d
|
||||
:em_delete_next_word,
|
||||
# 228 M-e
|
||||
:ed_unassigned,
|
||||
# 229 M-f
|
||||
:em_next_word,
|
||||
# 230 M-g
|
||||
:ed_unassigned,
|
||||
# 231 M-h
|
||||
:ed_unassigned,
|
||||
# 232 M-i
|
||||
:ed_unassigned,
|
||||
# 233 M-j
|
||||
:ed_unassigned,
|
||||
# 234 M-k
|
||||
:ed_unassigned,
|
||||
# 235 M-l
|
||||
:em_lower_case,
|
||||
# 236 M-m
|
||||
:ed_unassigned,
|
||||
# 237 M-n
|
||||
:ed_search_next_history,
|
||||
# 238 M-o
|
||||
:ed_unassigned,
|
||||
# 239 M-p
|
||||
:ed_search_prev_history,
|
||||
# 240 M-q
|
||||
:ed_unassigned,
|
||||
# 241 M-r
|
||||
:ed_unassigned,
|
||||
# 242 M-s
|
||||
:ed_unassigned,
|
||||
# 243 M-t
|
||||
:ed_unassigned,
|
||||
# 244 M-u
|
||||
:em_upper_case,
|
||||
# 245 M-v
|
||||
:ed_unassigned,
|
||||
# 246 M-w
|
||||
:em_copy_region,
|
||||
# 247 M-x
|
||||
:ed_command,
|
||||
# 248 M-y
|
||||
:ed_unassigned,
|
||||
# 249 M-z
|
||||
:ed_unassigned,
|
||||
# 250 M-{
|
||||
:ed_unassigned,
|
||||
# 251 M-|
|
||||
:ed_unassigned,
|
||||
# 252 M-}
|
||||
:ed_unassigned,
|
||||
# 253 M-~
|
||||
:ed_unassigned,
|
||||
# 254 M-^?
|
||||
:ed_delete_prev_word
|
||||
# 255
|
||||
# EOF
|
||||
]
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue