reline 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,56 @@
1
+ class Reline::History < Array
2
+ def initialize(config)
3
+ @config = config
4
+ end
5
+
6
+ def to_s
7
+ 'HISTORY'
8
+ end
9
+
10
+ def delete_at(index)
11
+ index = check_index(index)
12
+ super(index)
13
+ end
14
+
15
+ def [](index)
16
+ index = check_index(index)
17
+ super(index)
18
+ end
19
+
20
+ def []=(index, val)
21
+ index = check_index(index)
22
+ super(index, String.new(val, encoding: Encoding::default_external))
23
+ end
24
+
25
+ def concat(*val)
26
+ val.each do |v|
27
+ push(*v)
28
+ end
29
+ end
30
+
31
+ def push(*val)
32
+ diff = size + val.size - @config.history_size
33
+ if diff > 0
34
+ if diff <= size
35
+ shift(diff)
36
+ else
37
+ diff -= size
38
+ clear
39
+ val.shift(diff)
40
+ end
41
+ end
42
+ super(*(val.map{ |v| String.new(v, encoding: Encoding::default_external) }))
43
+ end
44
+
45
+ def <<(val)
46
+ shift if size + 1 > @config.history_size
47
+ super(String.new(val, encoding: Encoding::default_external))
48
+ end
49
+
50
+ private def check_index(index)
51
+ index += size if index < 0
52
+ raise RangeError.new("index=<#{index}>") if index < -@config.history_size or @config.history_size < index
53
+ raise IndexError.new("index=<#{index}>") if index < 0 or size <= index
54
+ index
55
+ end
56
+ end
@@ -35,9 +35,9 @@ class Reline::KeyActor::Emacs < Reline::KeyActor::Base
35
35
  # 16 ^P
36
36
  :ed_prev_history,
37
37
  # 17 ^Q
38
- :ed_ignore,
38
+ :ed_quoted_insert,
39
39
  # 18 ^R
40
- :ed_redisplay,
40
+ :ed_search_prev_history,
41
41
  # 19 ^S
42
42
  :ed_ignore,
43
43
  # 20 ^T
@@ -277,13 +277,13 @@ class Reline::KeyActor::Emacs < Reline::KeyActor::Base
277
277
  # 137 M-^I
278
278
  :ed_unassigned,
279
279
  # 138 M-^J
280
- :ed_unassigned,
280
+ :key_newline,
281
281
  # 139 M-^K
282
282
  :ed_unassigned,
283
283
  # 140 M-^L
284
284
  :ed_clear_screen,
285
285
  # 141 M-^M
286
- :ed_unassigned,
286
+ :key_newline,
287
287
  # 142 M-^N
288
288
  :ed_unassigned,
289
289
  # 143 M-^O
@@ -448,71 +448,70 @@ class Reline::KeyActor::Emacs < Reline::KeyActor::Base
448
448
  :ed_unassigned,
449
449
  # 223 M-_
450
450
  :ed_unassigned,
451
- # 223 M-`
451
+ # 224 M-`
452
452
  :ed_unassigned,
453
- # 224 M-a
453
+ # 225 M-a
454
454
  :ed_unassigned,
455
- # 225 M-b
455
+ # 226 M-b
456
456
  :ed_prev_word,
457
- # 226 M-c
457
+ # 227 M-c
458
458
  :em_capitol_case,
459
- # 227 M-d
459
+ # 228 M-d
460
460
  :em_delete_next_word,
461
- # 228 M-e
461
+ # 229 M-e
462
462
  :ed_unassigned,
463
- # 229 M-f
463
+ # 230 M-f
464
464
  :em_next_word,
465
- # 230 M-g
465
+ # 231 M-g
466
466
  :ed_unassigned,
467
- # 231 M-h
467
+ # 232 M-h
468
468
  :ed_unassigned,
469
- # 232 M-i
469
+ # 233 M-i
470
470
  :ed_unassigned,
471
- # 233 M-j
471
+ # 234 M-j
472
472
  :ed_unassigned,
473
- # 234 M-k
473
+ # 235 M-k
474
474
  :ed_unassigned,
475
- # 235 M-l
475
+ # 236 M-l
476
476
  :em_lower_case,
477
- # 236 M-m
477
+ # 237 M-m
478
478
  :ed_unassigned,
479
- # 237 M-n
479
+ # 238 M-n
480
480
  :ed_search_next_history,
481
- # 238 M-o
481
+ # 239 M-o
482
482
  :ed_unassigned,
483
- # 239 M-p
483
+ # 240 M-p
484
484
  :ed_search_prev_history,
485
- # 240 M-q
486
- :ed_unassigned,
487
- # 241 M-r
485
+ # 241 M-q
488
486
  :ed_unassigned,
489
- # 242 M-s
487
+ # 242 M-r
490
488
  :ed_unassigned,
491
- # 243 M-t
489
+ # 243 M-s
492
490
  :ed_unassigned,
493
- # 244 M-u
491
+ # 244 M-t
492
+ :ed_transpose_words,
493
+ # 245 M-u
494
494
  :em_upper_case,
495
- # 245 M-v
495
+ # 246 M-v
496
496
  :ed_unassigned,
497
- # 246 M-w
497
+ # 247 M-w
498
498
  :em_copy_region,
499
- # 247 M-x
499
+ # 248 M-x
500
500
  :ed_command,
501
- # 248 M-y
501
+ # 249 M-y
502
502
  :ed_unassigned,
503
- # 249 M-z
503
+ # 250 M-z
504
504
  :ed_unassigned,
505
- # 250 M-{
505
+ # 251 M-{
506
506
  :ed_unassigned,
507
- # 251 M-|
507
+ # 252 M-|
508
508
  :ed_unassigned,
509
- # 252 M-}
509
+ # 253 M-}
510
510
  :ed_unassigned,
511
- # 253 M-~
511
+ # 254 M-~
512
512
  :ed_unassigned,
513
- # 254 M-^?
513
+ # 255 M-^?
514
514
  :ed_delete_prev_word
515
- # 255
516
515
  # EOF
517
516
  ]
518
517
  end
@@ -149,7 +149,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
149
149
  # 73 I
150
150
  :vi_insert_at_bol,
151
151
  # 74 J
152
- :ed_search_next_history,
152
+ :vi_join_lines,
153
153
  # 75 K
154
154
  :ed_search_prev_history,
155
155
  # 76 L
@@ -189,7 +189,7 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
189
189
  # 93 ]
190
190
  :ed_unassigned,
191
191
  # 94 ^
192
- :ed_move_to_beg,
192
+ :vi_first_print,
193
193
  # 95 _
194
194
  :vi_history_word,
195
195
  # 96 `
@@ -448,71 +448,70 @@ class Reline::KeyActor::ViCommand < Reline::KeyActor::Base
448
448
  :ed_unassigned,
449
449
  # 223 M-_
450
450
  :ed_unassigned,
451
- # 223 M-`
451
+ # 224 M-`
452
452
  :ed_unassigned,
453
- # 224 M-a
453
+ # 225 M-a
454
454
  :ed_unassigned,
455
- # 225 M-b
455
+ # 226 M-b
456
456
  :ed_unassigned,
457
- # 226 M-c
457
+ # 227 M-c
458
458
  :ed_unassigned,
459
- # 227 M-d
459
+ # 228 M-d
460
460
  :ed_unassigned,
461
- # 228 M-e
461
+ # 229 M-e
462
462
  :ed_unassigned,
463
- # 229 M-f
463
+ # 230 M-f
464
464
  :ed_unassigned,
465
- # 230 M-g
465
+ # 231 M-g
466
466
  :ed_unassigned,
467
- # 231 M-h
467
+ # 232 M-h
468
468
  :ed_unassigned,
469
- # 232 M-i
469
+ # 233 M-i
470
470
  :ed_unassigned,
471
- # 233 M-j
471
+ # 234 M-j
472
472
  :ed_unassigned,
473
- # 234 M-k
473
+ # 235 M-k
474
474
  :ed_unassigned,
475
- # 235 M-l
475
+ # 236 M-l
476
476
  :ed_unassigned,
477
- # 236 M-m
477
+ # 237 M-m
478
478
  :ed_unassigned,
479
- # 237 M-n
479
+ # 238 M-n
480
480
  :ed_unassigned,
481
- # 238 M-o
481
+ # 239 M-o
482
482
  :ed_unassigned,
483
- # 239 M-p
483
+ # 240 M-p
484
484
  :ed_unassigned,
485
- # 240 M-q
485
+ # 241 M-q
486
486
  :ed_unassigned,
487
- # 241 M-r
487
+ # 242 M-r
488
488
  :ed_unassigned,
489
- # 242 M-s
489
+ # 243 M-s
490
490
  :ed_unassigned,
491
- # 243 M-t
491
+ # 244 M-t
492
492
  :ed_unassigned,
493
- # 244 M-u
493
+ # 245 M-u
494
494
  :ed_unassigned,
495
- # 245 M-v
495
+ # 246 M-v
496
496
  :ed_unassigned,
497
- # 246 M-w
497
+ # 247 M-w
498
498
  :ed_unassigned,
499
- # 247 M-x
499
+ # 248 M-x
500
500
  :ed_unassigned,
501
- # 248 M-y
501
+ # 249 M-y
502
502
  :ed_unassigned,
503
- # 249 M-z
503
+ # 250 M-z
504
504
  :ed_unassigned,
505
- # 250 M-{
505
+ # 251 M-{
506
506
  :ed_unassigned,
507
- # 251 M-|
507
+ # 252 M-|
508
508
  :ed_unassigned,
509
- # 252 M-}
509
+ # 253 M-}
510
510
  :ed_unassigned,
511
- # 253 M-~
511
+ # 254 M-~
512
512
  :ed_unassigned,
513
- # 254 M-^?
513
+ # 255 M-^?
514
514
  :ed_unassigned
515
- # 255
516
515
  # EOF
517
516
  ]
518
517
  end
@@ -257,262 +257,261 @@ class Reline::KeyActor::ViInsert < Reline::KeyActor::Base
257
257
  # 127 ^?
258
258
  :vi_delete_prev_char,
259
259
  # 128 M-^@
260
- :ed_insert,
260
+ :ed_unassigned,
261
261
  # 129 M-^A
262
- :ed_insert,
262
+ :ed_unassigned,
263
263
  # 130 M-^B
264
- :ed_insert,
264
+ :ed_unassigned,
265
265
  # 131 M-^C
266
- :ed_insert,
266
+ :ed_unassigned,
267
267
  # 132 M-^D
268
- :ed_insert,
268
+ :ed_unassigned,
269
269
  # 133 M-^E
270
- :ed_insert,
270
+ :ed_unassigned,
271
271
  # 134 M-^F
272
- :ed_insert,
272
+ :ed_unassigned,
273
273
  # 135 M-^G
274
- :ed_insert,
274
+ :ed_unassigned,
275
275
  # 136 M-^H
276
- :ed_insert,
276
+ :ed_unassigned,
277
277
  # 137 M-^I
278
- :ed_insert,
278
+ :ed_unassigned,
279
279
  # 138 M-^J
280
- :ed_insert,
280
+ :key_newline,
281
281
  # 139 M-^K
282
- :ed_insert,
282
+ :ed_unassigned,
283
283
  # 140 M-^L
284
- :ed_insert,
284
+ :ed_unassigned,
285
285
  # 141 M-^M
286
- :ed_insert,
286
+ :key_newline,
287
287
  # 142 M-^N
288
- :ed_insert,
288
+ :ed_unassigned,
289
289
  # 143 M-^O
290
- :ed_insert,
290
+ :ed_unassigned,
291
291
  # 144 M-^P
292
- :ed_insert,
292
+ :ed_unassigned,
293
293
  # 145 M-^Q
294
- :ed_insert,
294
+ :ed_unassigned,
295
295
  # 146 M-^R
296
- :ed_insert,
296
+ :ed_unassigned,
297
297
  # 147 M-^S
298
- :ed_insert,
298
+ :ed_unassigned,
299
299
  # 148 M-^T
300
- :ed_insert,
300
+ :ed_unassigned,
301
301
  # 149 M-^U
302
- :ed_insert,
302
+ :ed_unassigned,
303
303
  # 150 M-^V
304
- :ed_insert,
304
+ :ed_unassigned,
305
305
  # 151 M-^W
306
- :ed_insert,
306
+ :ed_unassigned,
307
307
  # 152 M-^X
308
- :ed_insert,
308
+ :ed_unassigned,
309
309
  # 153 M-^Y
310
- :ed_insert,
310
+ :ed_unassigned,
311
311
  # 154 M-^Z
312
- :ed_insert,
312
+ :ed_unassigned,
313
313
  # 155 M-^[
314
- :ed_insert,
314
+ :ed_unassigned,
315
315
  # 156 M-^\
316
- :ed_insert,
316
+ :ed_unassigned,
317
317
  # 157 M-^]
318
- :ed_insert,
318
+ :ed_unassigned,
319
319
  # 158 M-^^
320
- :ed_insert,
320
+ :ed_unassigned,
321
321
  # 159 M-^_
322
- :ed_insert,
322
+ :ed_unassigned,
323
323
  # 160 M-SPACE
324
- :ed_insert,
324
+ :ed_unassigned,
325
325
  # 161 M-!
326
- :ed_insert,
326
+ :ed_unassigned,
327
327
  # 162 M-"
328
- :ed_insert,
328
+ :ed_unassigned,
329
329
  # 163 M-#
330
- :ed_insert,
330
+ :ed_unassigned,
331
331
  # 164 M-$
332
- :ed_insert,
332
+ :ed_unassigned,
333
333
  # 165 M-%
334
- :ed_insert,
334
+ :ed_unassigned,
335
335
  # 166 M-&
336
- :ed_insert,
336
+ :ed_unassigned,
337
337
  # 167 M-'
338
- :ed_insert,
338
+ :ed_unassigned,
339
339
  # 168 M-(
340
- :ed_insert,
340
+ :ed_unassigned,
341
341
  # 169 M-)
342
- :ed_insert,
342
+ :ed_unassigned,
343
343
  # 170 M-*
344
- :ed_insert,
344
+ :ed_unassigned,
345
345
  # 171 M-+
346
- :ed_insert,
346
+ :ed_unassigned,
347
347
  # 172 M-,
348
- :ed_insert,
348
+ :ed_unassigned,
349
349
  # 173 M--
350
- :ed_insert,
350
+ :ed_unassigned,
351
351
  # 174 M-.
352
- :ed_insert,
352
+ :ed_unassigned,
353
353
  # 175 M-/
354
- :ed_insert,
354
+ :ed_unassigned,
355
355
  # 176 M-0
356
- :ed_insert,
356
+ :ed_unassigned,
357
357
  # 177 M-1
358
- :ed_insert,
358
+ :ed_unassigned,
359
359
  # 178 M-2
360
- :ed_insert,
360
+ :ed_unassigned,
361
361
  # 179 M-3
362
- :ed_insert,
362
+ :ed_unassigned,
363
363
  # 180 M-4
364
- :ed_insert,
364
+ :ed_unassigned,
365
365
  # 181 M-5
366
- :ed_insert,
366
+ :ed_unassigned,
367
367
  # 182 M-6
368
- :ed_insert,
368
+ :ed_unassigned,
369
369
  # 183 M-7
370
- :ed_insert,
370
+ :ed_unassigned,
371
371
  # 184 M-8
372
- :ed_insert,
372
+ :ed_unassigned,
373
373
  # 185 M-9
374
- :ed_insert,
374
+ :ed_unassigned,
375
375
  # 186 M-:
376
- :ed_insert,
376
+ :ed_unassigned,
377
377
  # 187 M-;
378
- :ed_insert,
378
+ :ed_unassigned,
379
379
  # 188 M-<
380
- :ed_insert,
380
+ :ed_unassigned,
381
381
  # 189 M-=
382
- :ed_insert,
382
+ :ed_unassigned,
383
383
  # 190 M->
384
- :ed_insert,
384
+ :ed_unassigned,
385
385
  # 191 M-?
386
- :ed_insert,
386
+ :ed_unassigned,
387
387
  # 192 M-@
388
- :ed_insert,
388
+ :ed_unassigned,
389
389
  # 193 M-A
390
- :ed_insert,
390
+ :ed_unassigned,
391
391
  # 194 M-B
392
- :ed_insert,
392
+ :ed_unassigned,
393
393
  # 195 M-C
394
- :ed_insert,
394
+ :ed_unassigned,
395
395
  # 196 M-D
396
- :ed_insert,
396
+ :ed_unassigned,
397
397
  # 197 M-E
398
- :ed_insert,
398
+ :ed_unassigned,
399
399
  # 198 M-F
400
- :ed_insert,
400
+ :ed_unassigned,
401
401
  # 199 M-G
402
- :ed_insert,
402
+ :ed_unassigned,
403
403
  # 200 M-H
404
- :ed_insert,
404
+ :ed_unassigned,
405
405
  # 201 M-I
406
- :ed_insert,
406
+ :ed_unassigned,
407
407
  # 202 M-J
408
- :ed_insert,
408
+ :ed_unassigned,
409
409
  # 203 M-K
410
- :ed_insert,
410
+ :ed_unassigned,
411
411
  # 204 M-L
412
- :ed_insert,
412
+ :ed_unassigned,
413
413
  # 205 M-M
414
- :ed_insert,
414
+ :ed_unassigned,
415
415
  # 206 M-N
416
- :ed_insert,
416
+ :ed_unassigned,
417
417
  # 207 M-O
418
- :ed_insert,
418
+ :ed_unassigned,
419
419
  # 208 M-P
420
- :ed_insert,
420
+ :ed_unassigned,
421
421
  # 209 M-Q
422
- :ed_insert,
422
+ :ed_unassigned,
423
423
  # 210 M-R
424
- :ed_insert,
424
+ :ed_unassigned,
425
425
  # 211 M-S
426
- :ed_insert,
426
+ :ed_unassigned,
427
427
  # 212 M-T
428
- :ed_insert,
428
+ :ed_unassigned,
429
429
  # 213 M-U
430
- :ed_insert,
430
+ :ed_unassigned,
431
431
  # 214 M-V
432
- :ed_insert,
432
+ :ed_unassigned,
433
433
  # 215 M-W
434
- :ed_insert,
434
+ :ed_unassigned,
435
435
  # 216 M-X
436
- :ed_insert,
436
+ :ed_unassigned,
437
437
  # 217 M-Y
438
- :ed_insert,
438
+ :ed_unassigned,
439
439
  # 218 M-Z
440
- :ed_insert,
440
+ :ed_unassigned,
441
441
  # 219 M-[
442
- :ed_insert,
442
+ :ed_unassigned,
443
443
  # 220 M-\
444
- :ed_insert,
444
+ :ed_unassigned,
445
445
  # 221 M-]
446
- :ed_insert,
446
+ :ed_unassigned,
447
447
  # 222 M-^
448
- :ed_insert,
448
+ :ed_unassigned,
449
449
  # 223 M-_
450
- :ed_insert,
451
- # 223 M-`
452
- :ed_insert,
453
- # 224 M-a
454
- :ed_insert,
455
- # 225 M-b
456
- :ed_insert,
457
- # 226 M-c
458
- :ed_insert,
459
- # 227 M-d
460
- :ed_insert,
461
- # 228 M-e
462
- :ed_insert,
463
- # 229 M-f
464
- :ed_insert,
465
- # 230 M-g
466
- :ed_insert,
467
- # 231 M-h
468
- :ed_insert,
469
- # 232 M-i
470
- :ed_insert,
471
- # 233 M-j
472
- :ed_insert,
473
- # 234 M-k
474
- :ed_insert,
475
- # 235 M-l
476
- :ed_insert,
477
- # 236 M-m
478
- :ed_insert,
479
- # 237 M-n
480
- :ed_insert,
481
- # 238 M-o
482
- :ed_insert,
483
- # 239 M-p
484
- :ed_insert,
485
- # 240 M-q
486
- :ed_insert,
487
- # 241 M-r
488
- :ed_insert,
489
- # 242 M-s
490
- :ed_insert,
491
- # 243 M-t
492
- :ed_insert,
493
- # 244 M-u
494
- :ed_insert,
495
- # 245 M-v
496
- :ed_insert,
497
- # 246 M-w
498
- :ed_insert,
499
- # 247 M-x
500
- :ed_insert,
501
- # 248 M-y
502
- :ed_insert,
503
- # 249 M-z
504
- :ed_insert,
505
- # 250 M-{
506
- :ed_insert,
507
- # 251 M-|
508
- :ed_insert,
509
- # 252 M-}
510
- :ed_insert,
511
- # 253 M-~
512
- :ed_insert,
513
- # 254 M-^?
514
- :ed_insert
515
- # 255
450
+ :ed_unassigned,
451
+ # 224 M-`
452
+ :ed_unassigned,
453
+ # 225 M-a
454
+ :ed_unassigned,
455
+ # 226 M-b
456
+ :ed_unassigned,
457
+ # 227 M-c
458
+ :ed_unassigned,
459
+ # 228 M-d
460
+ :ed_unassigned,
461
+ # 229 M-e
462
+ :ed_unassigned,
463
+ # 230 M-f
464
+ :ed_unassigned,
465
+ # 231 M-g
466
+ :ed_unassigned,
467
+ # 232 M-h
468
+ :ed_unassigned,
469
+ # 233 M-i
470
+ :ed_unassigned,
471
+ # 234 M-j
472
+ :ed_unassigned,
473
+ # 235 M-k
474
+ :ed_unassigned,
475
+ # 236 M-l
476
+ :ed_unassigned,
477
+ # 237 M-m
478
+ :ed_unassigned,
479
+ # 238 M-n
480
+ :ed_unassigned,
481
+ # 239 M-o
482
+ :ed_unassigned,
483
+ # 240 M-p
484
+ :ed_unassigned,
485
+ # 241 M-q
486
+ :ed_unassigned,
487
+ # 242 M-r
488
+ :ed_unassigned,
489
+ # 243 M-s
490
+ :ed_unassigned,
491
+ # 244 M-t
492
+ :ed_unassigned,
493
+ # 245 M-u
494
+ :ed_unassigned,
495
+ # 246 M-v
496
+ :ed_unassigned,
497
+ # 247 M-w
498
+ :ed_unassigned,
499
+ # 248 M-x
500
+ :ed_unassigned,
501
+ # 249 M-y
502
+ :ed_unassigned,
503
+ # 250 M-z
504
+ :ed_unassigned,
505
+ # 251 M-{
506
+ :ed_unassigned,
507
+ # 252 M-|
508
+ :ed_unassigned,
509
+ # 253 M-}
510
+ :ed_unassigned,
511
+ # 254 M-~
512
+ :ed_unassigned,
513
+ # 255 M-^?
514
+ :ed_unassigned
516
515
  # EOF
517
516
  ]
518
517
  end