reline 0.2.8.pre.1 → 0.2.8.pre.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reline/ansi.rb +1 -0
- data/lib/reline/config.rb +9 -0
- data/lib/reline/line_editor.rb +115 -62
- data/lib/reline/unicode.rb +6 -5
- data/lib/reline/version.rb +1 -1
- data/lib/reline/windows.rb +12 -0
- data/lib/reline.rb +13 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fca2b6f76f8c59a18589d6d730f7f159e25b95e639ae7d6866f772e9bb2655ab
|
4
|
+
data.tar.gz: 61b69c3d01f74b957c6a2d646e58021cad4b49031d4fdf6437f2303d417d5f36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 561ffdbf39c095852f0a642178d5328329cea072fdc91c32bd11edfdcecb4846414006961b6fe7adbf63c825022a8634d5a563fdeb574d127088b536967e1f9c
|
7
|
+
data.tar.gz: 07e62e55ca7a45d3b747724823b26af09d109f9620ba82914cfaf7e6100251bb76bd0de7b01b9829b51e41248a32b028bbbb3617c7d4eedfc2c1d05ab701a236
|
data/lib/reline/ansi.rb
CHANGED
@@ -37,6 +37,7 @@ class Reline::ANSI
|
|
37
37
|
# default bindings
|
38
38
|
[27, 32] => :em_set_mark, # M-<space>
|
39
39
|
[24, 24] => :em_exchange_mark, # C-x C-x
|
40
|
+
[27, 91, 90] => :completion_journey_up, # S-Tab
|
40
41
|
}.each_pair do |key, func|
|
41
42
|
config.add_default_key_binding_by_keymap(:emacs, key, func)
|
42
43
|
end
|
data/lib/reline/config.rb
CHANGED
@@ -65,6 +65,7 @@ class Reline::Config
|
|
65
65
|
@history_size = -1 # unlimited
|
66
66
|
@keyseq_timeout = 500
|
67
67
|
@test_mode = false
|
68
|
+
@autocompletion = false
|
68
69
|
end
|
69
70
|
|
70
71
|
def reset
|
@@ -89,6 +90,14 @@ class Reline::Config
|
|
89
90
|
(val.respond_to?(:any?) ? val : [val]).any?(@editing_mode_label)
|
90
91
|
end
|
91
92
|
|
93
|
+
def autocompletion=(val)
|
94
|
+
@autocompletion = val
|
95
|
+
end
|
96
|
+
|
97
|
+
def autocompletion
|
98
|
+
@autocompletion
|
99
|
+
end
|
100
|
+
|
92
101
|
def keymap
|
93
102
|
@key_actors[@keymap_label]
|
94
103
|
end
|
data/lib/reline/line_editor.rb
CHANGED
@@ -479,8 +479,9 @@ class Reline::LineEditor
|
|
479
479
|
end
|
480
480
|
|
481
481
|
class DialogProcScope
|
482
|
-
def initialize(line_editor, proc_to_exec, context)
|
482
|
+
def initialize(line_editor, config, proc_to_exec, context)
|
483
483
|
@line_editor = line_editor
|
484
|
+
@config = config
|
484
485
|
@proc_to_exec = proc_to_exec
|
485
486
|
@context = context
|
486
487
|
@cursor_pos = Reline::CursorPos.new
|
@@ -498,6 +499,14 @@ class Reline::LineEditor
|
|
498
499
|
@line_editor.call_completion_proc_with_checking_args(pre, target, post)
|
499
500
|
end
|
500
501
|
|
502
|
+
def set_dialog(dialog)
|
503
|
+
@dialog = dialog
|
504
|
+
end
|
505
|
+
|
506
|
+
def dialog
|
507
|
+
@dialog
|
508
|
+
end
|
509
|
+
|
501
510
|
def set_cursor_pos(col, row)
|
502
511
|
@cursor_pos.x = col
|
503
512
|
@cursor_pos.y = row
|
@@ -519,32 +528,50 @@ class Reline::LineEditor
|
|
519
528
|
@line_editor.instance_variable_get(:@completion_journey_data)
|
520
529
|
end
|
521
530
|
|
531
|
+
def config
|
532
|
+
@config
|
533
|
+
end
|
534
|
+
|
522
535
|
def call
|
523
536
|
instance_exec(&@proc_to_exec)
|
524
537
|
end
|
525
538
|
end
|
526
539
|
|
527
540
|
class Dialog
|
528
|
-
attr_reader :name
|
529
|
-
attr_accessor :
|
541
|
+
attr_reader :name, :contents, :width
|
542
|
+
attr_accessor :scroll_top, :column, :vertical_offset, :lines_backup
|
530
543
|
|
531
544
|
def initialize(name, proc_scope)
|
532
545
|
@name = name
|
533
546
|
@proc_scope = proc_scope
|
547
|
+
@width = nil
|
548
|
+
@scroll_top = 0
|
534
549
|
end
|
535
550
|
|
536
551
|
def set_cursor_pos(col, row)
|
537
552
|
@proc_scope.set_cursor_pos(col, row)
|
538
553
|
end
|
539
554
|
|
555
|
+
def width=(v)
|
556
|
+
@width = v
|
557
|
+
end
|
558
|
+
|
559
|
+
def contents=(contents)
|
560
|
+
@contents = contents
|
561
|
+
if contents and @width.nil?
|
562
|
+
@width = contents.map{ |line| Reline::Unicode.calculate_width(line, true) }.max
|
563
|
+
end
|
564
|
+
end
|
565
|
+
|
540
566
|
def call
|
567
|
+
@proc_scope.set_dialog(self)
|
541
568
|
@proc_scope.call
|
542
569
|
end
|
543
570
|
end
|
544
571
|
|
545
572
|
def add_dialog_proc(name, p, context = nil)
|
546
573
|
return if @dialogs.any? { |d| d.name == name }
|
547
|
-
@dialogs << Dialog.new(name, DialogProcScope.new(self, p, context))
|
574
|
+
@dialogs << Dialog.new(name, DialogProcScope.new(self, @config, p, context))
|
548
575
|
end
|
549
576
|
|
550
577
|
DIALOG_HEIGHT = 20
|
@@ -561,13 +588,26 @@ class Reline::LineEditor
|
|
561
588
|
return
|
562
589
|
end
|
563
590
|
dialog.set_cursor_pos(cursor_column, @first_line_started_from + @started_from)
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
dialog.contents =
|
591
|
+
dialog_render_info = dialog.call
|
592
|
+
dialog.width = dialog_render_info.width if dialog_render_info and dialog_render_info.width
|
593
|
+
old_dialog = dialog.clone
|
594
|
+
if dialog_render_info and dialog_render_info.contents and not dialog_render_info.contents.empty?
|
595
|
+
height = dialog_render_info.height || DIALOG_HEIGHT
|
596
|
+
pointer = dialog_render_info.pointer
|
597
|
+
dialog.contents = dialog_render_info.contents
|
598
|
+
if dialog.contents.size > height
|
599
|
+
if dialog_render_info.pointer
|
600
|
+
if dialog_render_info.pointer < 0
|
601
|
+
dialog.scroll_top = 0
|
602
|
+
elsif (dialog_render_info.pointer - dialog.scroll_top) >= (height - 1)
|
603
|
+
dialog.scroll_top = dialog_render_info.pointer - (height - 1)
|
604
|
+
elsif (dialog_render_info.pointer - dialog.scroll_top) < 0
|
605
|
+
dialog.scroll_top = dialog_render_info.pointer
|
606
|
+
end
|
607
|
+
pointer = dialog_render_info.pointer - dialog.scroll_top
|
608
|
+
end
|
609
|
+
dialog.contents = dialog.contents[dialog.scroll_top, height]
|
610
|
+
end
|
571
611
|
else
|
572
612
|
dialog.lines_backup = {
|
573
613
|
lines: modify_lines(whole_lines),
|
@@ -582,37 +622,37 @@ class Reline::LineEditor
|
|
582
622
|
end
|
583
623
|
upper_space = @first_line_started_from - @started_from
|
584
624
|
lower_space = @highest_in_all - @first_line_started_from - @started_from - 1
|
585
|
-
dialog.column = pos.x
|
586
|
-
diff = (dialog.column +
|
625
|
+
dialog.column = dialog_render_info.pos.x
|
626
|
+
diff = (dialog.column + dialog.width) - (@screen_size.last - 1)
|
587
627
|
if diff > 0
|
588
628
|
dialog.column -= diff
|
589
629
|
end
|
590
|
-
if (lower_space + @rest_height) >=
|
591
|
-
dialog.vertical_offset = pos.y + 1
|
592
|
-
elsif upper_space >=
|
593
|
-
dialog.vertical_offset = pos.y + -(
|
630
|
+
if (lower_space + @rest_height - dialog_render_info.pos.y) >= height
|
631
|
+
dialog.vertical_offset = dialog_render_info.pos.y + 1
|
632
|
+
elsif upper_space >= height
|
633
|
+
dialog.vertical_offset = dialog_render_info.pos.y + -(height + 1)
|
594
634
|
else
|
595
|
-
if (lower_space + @rest_height) <
|
596
|
-
scroll_down(
|
597
|
-
move_cursor_up(
|
635
|
+
if (lower_space + @rest_height - dialog_render_info.pos.y) < height
|
636
|
+
scroll_down(height + dialog_render_info.pos.y)
|
637
|
+
move_cursor_up(height + dialog_render_info.pos.y)
|
598
638
|
end
|
599
|
-
dialog.vertical_offset = pos.y + 1
|
639
|
+
dialog.vertical_offset = dialog_render_info.pos.y + 1
|
600
640
|
end
|
601
641
|
Reline::IOGate.hide_cursor
|
602
|
-
reset_dialog(dialog,
|
642
|
+
reset_dialog(dialog, old_dialog)
|
603
643
|
move_cursor_down(dialog.vertical_offset)
|
604
644
|
Reline::IOGate.move_cursor_column(dialog.column)
|
605
645
|
dialog.contents.each_with_index do |item, i|
|
606
646
|
if i == pointer
|
607
647
|
bg_color = '45'
|
608
648
|
else
|
609
|
-
if
|
610
|
-
bg_color =
|
649
|
+
if dialog_render_info.bg_color
|
650
|
+
bg_color = dialog_render_info.bg_color
|
611
651
|
else
|
612
652
|
bg_color = '46'
|
613
653
|
end
|
614
654
|
end
|
615
|
-
@output.write "\e[#{bg_color}m%-#{
|
655
|
+
@output.write "\e[#{bg_color}m%-#{dialog.width}s\e[49m" % Reline::Unicode.take_range(item, 0, dialog.width)
|
616
656
|
Reline::IOGate.move_cursor_column(dialog.column)
|
617
657
|
move_cursor_down(1) if i < (dialog.contents.size - 1)
|
618
658
|
end
|
@@ -628,8 +668,8 @@ class Reline::LineEditor
|
|
628
668
|
}
|
629
669
|
end
|
630
670
|
|
631
|
-
private def reset_dialog(dialog,
|
632
|
-
return if dialog.lines_backup.nil? or
|
671
|
+
private def reset_dialog(dialog, old_dialog)
|
672
|
+
return if dialog.lines_backup.nil? or old_dialog.contents.nil?
|
633
673
|
prompt, prompt_width, prompt_list = check_multiline_prompt(dialog.lines_backup[:lines], prompt)
|
634
674
|
visual_lines = []
|
635
675
|
visual_start = nil
|
@@ -645,76 +685,76 @@ class Reline::LineEditor
|
|
645
685
|
old_y = dialog.lines_backup[:first_line_started_from] + dialog.lines_backup[:started_from]
|
646
686
|
y = @first_line_started_from + @started_from
|
647
687
|
y_diff = y - old_y
|
648
|
-
if (old_y +
|
688
|
+
if (old_y + old_dialog.vertical_offset) < (y + dialog.vertical_offset)
|
649
689
|
# rerender top
|
650
|
-
move_cursor_down(
|
651
|
-
start = visual_start +
|
652
|
-
line_num = dialog.vertical_offset -
|
690
|
+
move_cursor_down(old_dialog.vertical_offset - y_diff)
|
691
|
+
start = visual_start + old_dialog.vertical_offset
|
692
|
+
line_num = dialog.vertical_offset - old_dialog.vertical_offset
|
653
693
|
line_num.times do |i|
|
654
|
-
Reline::IOGate.move_cursor_column(
|
694
|
+
Reline::IOGate.move_cursor_column(old_dialog.column)
|
655
695
|
if visual_lines[start + i].nil?
|
656
|
-
s = ' ' *
|
696
|
+
s = ' ' * dialog.width
|
657
697
|
else
|
658
|
-
s = Reline::Unicode.take_range(visual_lines[start + i],
|
698
|
+
s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog.column, dialog.width)
|
659
699
|
end
|
660
|
-
@output.write "\e[39m\e[49m%-#{
|
700
|
+
@output.write "\e[39m\e[49m%-#{dialog.width}s\e[39m\e[49m" % s
|
661
701
|
move_cursor_down(1) if i < (line_num - 1)
|
662
702
|
end
|
663
|
-
move_cursor_up(
|
703
|
+
move_cursor_up(old_dialog.vertical_offset + line_num - 1 - y_diff)
|
664
704
|
end
|
665
|
-
if (old_y +
|
705
|
+
if (old_y + old_dialog.vertical_offset + old_dialog.contents.size) > (y + dialog.vertical_offset + dialog.contents.size)
|
666
706
|
# rerender bottom
|
667
707
|
move_cursor_down(dialog.vertical_offset + dialog.contents.size - y_diff)
|
668
708
|
start = visual_start + dialog.vertical_offset + dialog.contents.size
|
669
|
-
line_num = (
|
709
|
+
line_num = (old_dialog.vertical_offset + old_dialog.contents.size) - (dialog.vertical_offset + dialog.contents.size)
|
670
710
|
line_num.times do |i|
|
671
|
-
Reline::IOGate.move_cursor_column(
|
711
|
+
Reline::IOGate.move_cursor_column(old_dialog.column)
|
672
712
|
if visual_lines[start + i].nil?
|
673
|
-
s = ' ' *
|
713
|
+
s = ' ' * dialog.width
|
674
714
|
else
|
675
|
-
s = Reline::Unicode.take_range(visual_lines[start + i],
|
715
|
+
s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog.column, dialog.width)
|
676
716
|
end
|
677
|
-
@output.write "\e[39m\e[49m%-#{
|
717
|
+
@output.write "\e[39m\e[49m%-#{dialog.width}s\e[39m\e[49m" % s
|
678
718
|
move_cursor_down(1) if i < (line_num - 1)
|
679
719
|
end
|
680
720
|
move_cursor_up(dialog.vertical_offset + dialog.contents.size + line_num - 1 - y_diff)
|
681
721
|
end
|
682
|
-
if
|
722
|
+
if old_dialog.column < dialog.column
|
683
723
|
# rerender left
|
684
|
-
move_cursor_down(
|
685
|
-
width = dialog.column -
|
686
|
-
start = visual_start +
|
687
|
-
line_num =
|
724
|
+
move_cursor_down(old_dialog.vertical_offset - y_diff)
|
725
|
+
width = dialog.column - old_dialog.column
|
726
|
+
start = visual_start + old_dialog.vertical_offset
|
727
|
+
line_num = old_dialog.contents.size
|
688
728
|
line_num.times do |i|
|
689
|
-
Reline::IOGate.move_cursor_column(
|
729
|
+
Reline::IOGate.move_cursor_column(old_dialog.column)
|
690
730
|
if visual_lines[start + i].nil?
|
691
731
|
s = ' ' * width
|
692
732
|
else
|
693
|
-
s = Reline::Unicode.take_range(visual_lines[start + i],
|
733
|
+
s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog.column, width)
|
694
734
|
end
|
695
735
|
@output.write "\e[39m\e[49m%-#{width}s\e[39m\e[49m" % s
|
696
736
|
move_cursor_down(1) if i < (line_num - 1)
|
697
737
|
end
|
698
|
-
move_cursor_up(
|
738
|
+
move_cursor_up(old_dialog.vertical_offset + line_num - 1 - y_diff)
|
699
739
|
end
|
700
|
-
if (
|
740
|
+
if (old_dialog.column + old_dialog.width) > (dialog.column + dialog.width)
|
701
741
|
# rerender right
|
702
|
-
move_cursor_down(
|
703
|
-
width = (
|
704
|
-
start = visual_start +
|
705
|
-
line_num =
|
742
|
+
move_cursor_down(old_dialog.vertical_offset + y_diff)
|
743
|
+
width = (old_dialog.column + old_dialog.width) - (dialog.column + dialog.width)
|
744
|
+
start = visual_start + old_dialog.vertical_offset
|
745
|
+
line_num = old_dialog.contents.size
|
706
746
|
line_num.times do |i|
|
707
|
-
Reline::IOGate.move_cursor_column(
|
747
|
+
Reline::IOGate.move_cursor_column(old_dialog.column + dialog.width)
|
708
748
|
if visual_lines[start + i].nil?
|
709
749
|
s = ' ' * width
|
710
750
|
else
|
711
|
-
s = Reline::Unicode.take_range(visual_lines[start + i],
|
751
|
+
s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog.column + dialog.width, width)
|
712
752
|
end
|
713
|
-
Reline::IOGate.move_cursor_column(dialog.column +
|
753
|
+
Reline::IOGate.move_cursor_column(dialog.column + dialog.width)
|
714
754
|
@output.write "\e[39m\e[49m%-#{width}s\e[39m\e[49m" % s
|
715
755
|
move_cursor_down(1) if i < (line_num - 1)
|
716
756
|
end
|
717
|
-
move_cursor_up(
|
757
|
+
move_cursor_up(old_dialog.vertical_offset + line_num - 1 + y_diff)
|
718
758
|
end
|
719
759
|
Reline::IOGate.move_cursor_column((prompt_width + @cursor) % @screen_size.last)
|
720
760
|
end
|
@@ -748,10 +788,10 @@ class Reline::LineEditor
|
|
748
788
|
dialog_vertical_size.times do |i|
|
749
789
|
if i < visual_lines_under_dialog.size
|
750
790
|
Reline::IOGate.move_cursor_column(0)
|
751
|
-
@output.write "\e[39m\e[49m%-#{
|
791
|
+
@output.write "\e[39m\e[49m%-#{dialog.width}s\e[39m\e[49m" % visual_lines_under_dialog[i]
|
752
792
|
else
|
753
793
|
Reline::IOGate.move_cursor_column(dialog.column)
|
754
|
-
@output.write "\e[39m\e[49m#{' ' *
|
794
|
+
@output.write "\e[39m\e[49m#{' ' * dialog.width}\e[39m\e[49m"
|
755
795
|
end
|
756
796
|
Reline::IOGate.erase_after_cursor
|
757
797
|
move_cursor_down(1) if i < (dialog_vertical_size - 1)
|
@@ -1426,7 +1466,20 @@ class Reline::LineEditor
|
|
1426
1466
|
if result.is_a?(Array)
|
1427
1467
|
completion_occurs = true
|
1428
1468
|
process_insert
|
1429
|
-
|
1469
|
+
if @config.autocompletion
|
1470
|
+
move_completed_list(result, :down)
|
1471
|
+
else
|
1472
|
+
complete(result)
|
1473
|
+
end
|
1474
|
+
end
|
1475
|
+
end
|
1476
|
+
elsif @config.editing_mode_is?(:emacs, :vi_insert) and key.char == :completion_journey_up
|
1477
|
+
if not @config.disable_completion and @config.autocompletion
|
1478
|
+
result = call_completion_proc
|
1479
|
+
if result.is_a?(Array)
|
1480
|
+
completion_occurs = true
|
1481
|
+
process_insert
|
1482
|
+
move_completed_list(result, :up)
|
1430
1483
|
end
|
1431
1484
|
end
|
1432
1485
|
elsif not @config.disable_completion and @config.editing_mode_is?(:vi_insert) and ["\C-p".ord, "\C-n".ord].include?(key.char)
|
data/lib/reline/unicode.rb
CHANGED
@@ -186,9 +186,9 @@ class Reline::Unicode
|
|
186
186
|
end
|
187
187
|
|
188
188
|
# Take a chunk of a String with escape sequences.
|
189
|
-
def self.take_range(str,
|
189
|
+
def self.take_range(str, start_col, max_width, encoding = str.encoding)
|
190
190
|
chunk = String.new(encoding: encoding)
|
191
|
-
|
191
|
+
total_width = 0
|
192
192
|
rest = str.encode(Encoding::UTF_8)
|
193
193
|
in_zero_width = false
|
194
194
|
rest.scan(WIDTH_SCANNER) do |gc|
|
@@ -206,9 +206,10 @@ class Reline::Unicode
|
|
206
206
|
if in_zero_width
|
207
207
|
chunk << gc
|
208
208
|
else
|
209
|
-
|
210
|
-
|
211
|
-
|
209
|
+
mbchar_width = get_mbchar_width(gc)
|
210
|
+
total_width += mbchar_width
|
211
|
+
break if (start_col + max_width) < total_width
|
212
|
+
chunk << gc if start_col < total_width
|
212
213
|
end
|
213
214
|
end
|
214
215
|
end
|
data/lib/reline/version.rb
CHANGED
data/lib/reline/windows.rb
CHANGED
@@ -42,6 +42,14 @@ class Reline::Windows
|
|
42
42
|
}.each_pair do |key, func|
|
43
43
|
config.add_default_key_binding_by_keymap(:emacs, key, func)
|
44
44
|
end
|
45
|
+
|
46
|
+
# Emulate ANSI key sequence.
|
47
|
+
{
|
48
|
+
[27, 91, 90] => :completion_journey_up, # S-Tab
|
49
|
+
}.each_pair do |key, func|
|
50
|
+
config.add_default_key_binding_by_keymap(:emacs, key, func)
|
51
|
+
config.add_default_key_binding_by_keymap(:vi_insert, key, func)
|
52
|
+
end
|
45
53
|
end
|
46
54
|
|
47
55
|
if defined? JRUBY_VERSION
|
@@ -106,6 +114,7 @@ class Reline::Windows
|
|
106
114
|
SCROLLLOCK_ON = 0x0040
|
107
115
|
SHIFT_PRESSED = 0x0010
|
108
116
|
|
117
|
+
VK_TAB = 0x09
|
109
118
|
VK_END = 0x23
|
110
119
|
VK_HOME = 0x24
|
111
120
|
VK_LEFT = 0x25
|
@@ -199,6 +208,9 @@ class Reline::Windows
|
|
199
208
|
[ { control_keys: [], virtual_key_code: VK_DELETE }, [0, 83] ],
|
200
209
|
[ { control_keys: [], virtual_key_code: VK_HOME }, [0, 71] ],
|
201
210
|
[ { control_keys: [], virtual_key_code: VK_END }, [0, 79] ],
|
211
|
+
|
212
|
+
# Emulate ANSI key sequence.
|
213
|
+
[ { control_keys: :SHIFT, virtual_key_code: VK_TAB }, [27, 91, 90] ],
|
202
214
|
]
|
203
215
|
|
204
216
|
def self.process_key_event(repeat_count, virtual_key_code, virtual_scan_code, char_code, control_key_state)
|
data/lib/reline.rb
CHANGED
@@ -18,6 +18,7 @@ module Reline
|
|
18
18
|
|
19
19
|
Key = Struct.new('Key', :char, :combined_char, :with_meta)
|
20
20
|
CursorPos = Struct.new(:x, :y)
|
21
|
+
DialogRenderInfo = Struct.new(:pos, :contents, :pointer, :bg_color, :width, :height, keyword_init: true)
|
21
22
|
|
22
23
|
class Core
|
23
24
|
ATTR_READER_NAMES = %i(
|
@@ -107,6 +108,14 @@ module Reline
|
|
107
108
|
@completion_proc = p
|
108
109
|
end
|
109
110
|
|
111
|
+
def autocompletion
|
112
|
+
@config.autocompletion
|
113
|
+
end
|
114
|
+
|
115
|
+
def autocompletion=(val)
|
116
|
+
@config.autocompletion = val
|
117
|
+
end
|
118
|
+
|
110
119
|
def output_modifier_proc=(p)
|
111
120
|
raise ArgumentError unless p.respond_to?(:call) or p.nil?
|
112
121
|
@output_modifier_proc = p
|
@@ -180,6 +189,7 @@ module Reline
|
|
180
189
|
|
181
190
|
Reline::DEFAULT_DIALOG_PROC_AUTOCOMPLETE = ->() {
|
182
191
|
# autocomplete
|
192
|
+
return nil unless config.autocompletion
|
183
193
|
if just_cursor_moving and completion_journey_data.nil?
|
184
194
|
# Auto complete starts only when edited
|
185
195
|
return nil
|
@@ -210,9 +220,9 @@ module Reline
|
|
210
220
|
cursor_pos_to_render = Reline::CursorPos.new(x, y)
|
211
221
|
if context and context.is_a?(Array)
|
212
222
|
context.clear
|
213
|
-
context.push(cursor_pos_to_render, result, pointer)
|
223
|
+
context.push(cursor_pos_to_render, result, pointer, dialog)
|
214
224
|
end
|
215
|
-
|
225
|
+
DialogRenderInfo.new(pos: cursor_pos_to_render, contents: result, pointer: pointer, height: 15)
|
216
226
|
}
|
217
227
|
Reline::DEFAULT_DIALOG_CONTEXT = Array.new
|
218
228
|
|
@@ -474,6 +484,7 @@ module Reline
|
|
474
484
|
def_single_delegators :core, :last_incremental_search
|
475
485
|
def_single_delegators :core, :last_incremental_search=
|
476
486
|
def_single_delegators :core, :add_dialog_proc
|
487
|
+
def_single_delegators :core, :autocompletion, :autocompletion=
|
477
488
|
|
478
489
|
def_single_delegators :core, :readmultiline
|
479
490
|
def_instance_delegators self, :readmultiline
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.8.pre.
|
4
|
+
version: 0.2.8.pre.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aycabta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: io-console
|