reline 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reline/key_actor/emacs.rb +1 -1
- data/lib/reline/line_editor.rb +29 -18
- data/lib/reline/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7612855f90bdd7b5602c7d9e7b2b4de200d6986c45ff64b5a356380c1211b83e
|
4
|
+
data.tar.gz: 58406022787d706f400e828e31fde79b3e90c09a106b82a84218e5b748725db4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcd02ec0e09c6dafa6cf3e9e1dbbeab9befabe033a1ae581628ff01fb4435fce3bb4cbe4cccb5890761e1a58a6637379a5f154ed67f28edaf46a71ba6a00d5c1
|
7
|
+
data.tar.gz: 55a61bcab1c41d35002462c80f11d4406426a815bc84ddb680f73c023139fea95e89bc5cc3d1a9e25f1b77ed0986923e5152cfdd489b9e484bd2e459a6602256
|
data/lib/reline/line_editor.rb
CHANGED
@@ -595,14 +595,22 @@ class Reline::LineEditor
|
|
595
595
|
[target, preposing, completed, postposing]
|
596
596
|
end
|
597
597
|
|
598
|
-
private def complete(list)
|
598
|
+
private def complete(list, just_show_list = false)
|
599
599
|
case @completion_state
|
600
600
|
when CompletionState::NORMAL, CompletionState::JOURNEY
|
601
601
|
@completion_state = CompletionState::COMPLETION
|
602
602
|
when CompletionState::PERFECT_MATCH
|
603
603
|
@dig_perfect_match_proc&.(@perfect_matched)
|
604
604
|
end
|
605
|
-
|
605
|
+
if just_show_list
|
606
|
+
is_menu = true
|
607
|
+
elsif @completion_state == CompletionState::MENU
|
608
|
+
is_menu = true
|
609
|
+
elsif @completion_state == CompletionState::MENU_WITH_PERFECT_MATCH
|
610
|
+
is_menu = true
|
611
|
+
else
|
612
|
+
is_menu = false
|
613
|
+
end
|
606
614
|
result = complete_internal_proc(list, is_menu)
|
607
615
|
if @completion_state == CompletionState::MENU_WITH_PERFECT_MATCH
|
608
616
|
@completion_state = CompletionState::PERFECT_MATCH
|
@@ -621,7 +629,7 @@ class Reline::LineEditor
|
|
621
629
|
else
|
622
630
|
@completion_state = CompletionState::MENU
|
623
631
|
end
|
624
|
-
if target < completed
|
632
|
+
if not just_show_list and target < completed
|
625
633
|
@line = preposing + completed + completion_append_character.to_s + postposing
|
626
634
|
line_to_pointer = preposing + completed + completion_append_character.to_s
|
627
635
|
@cursor_max = calculate_width(@line)
|
@@ -911,6 +919,7 @@ class Reline::LineEditor
|
|
911
919
|
elsif not quote and slice =~ word_break_regexp
|
912
920
|
rest = $'
|
913
921
|
i += 1
|
922
|
+
before = @line.byteslice(i, @byte_pointer - i)
|
914
923
|
break_pointer = i
|
915
924
|
else
|
916
925
|
i += 1
|
@@ -1567,7 +1576,7 @@ class Reline::LineEditor
|
|
1567
1576
|
end
|
1568
1577
|
end
|
1569
1578
|
|
1570
|
-
private def
|
1579
|
+
private def em_delete(key)
|
1571
1580
|
if (not @is_multiline and @line.empty?) or (@is_multiline and @line.empty? and @buffer_of_lines.size == 1)
|
1572
1581
|
@line = nil
|
1573
1582
|
if @buffer_of_lines.size > 1
|
@@ -1592,7 +1601,19 @@ class Reline::LineEditor
|
|
1592
1601
|
@rest_height += 1
|
1593
1602
|
end
|
1594
1603
|
end
|
1595
|
-
alias_method :delete_char, :
|
1604
|
+
alias_method :delete_char, :em_delete
|
1605
|
+
|
1606
|
+
private def em_delete_or_list(key)
|
1607
|
+
if @line.empty? or @byte_pointer < @line.bytesize
|
1608
|
+
em_delete(key)
|
1609
|
+
else # show completed list
|
1610
|
+
result = call_completion_proc
|
1611
|
+
if result.is_a?(Array)
|
1612
|
+
complete(result, true)
|
1613
|
+
end
|
1614
|
+
end
|
1615
|
+
end
|
1616
|
+
alias_method :delete_char_or_list, :em_delete_or_list
|
1596
1617
|
|
1597
1618
|
private def em_yank(key)
|
1598
1619
|
yanked = @kill_ring.yank
|
@@ -1896,18 +1917,6 @@ class Reline::LineEditor
|
|
1896
1917
|
private def vi_yank(key)
|
1897
1918
|
end
|
1898
1919
|
|
1899
|
-
private def vi_end_of_transmission(key)
|
1900
|
-
if @line.empty?
|
1901
|
-
@line = nil
|
1902
|
-
if @buffer_of_lines.size > 1
|
1903
|
-
scroll_down(@highest_in_all - @first_line_started_from)
|
1904
|
-
end
|
1905
|
-
Reline::IOGate.move_cursor_column(0)
|
1906
|
-
@eof = true
|
1907
|
-
finish
|
1908
|
-
end
|
1909
|
-
end
|
1910
|
-
|
1911
1920
|
private def vi_list_or_eof(key)
|
1912
1921
|
if (not @is_multiline and @line.empty?) or (@is_multiline and @line.empty? and @buffer_of_lines.size == 1)
|
1913
1922
|
@line = nil
|
@@ -1918,9 +1927,11 @@ class Reline::LineEditor
|
|
1918
1927
|
@eof = true
|
1919
1928
|
finish
|
1920
1929
|
else
|
1921
|
-
|
1930
|
+
ed_newline(key)
|
1922
1931
|
end
|
1923
1932
|
end
|
1933
|
+
alias_method :vi_end_of_transmission, :vi_list_or_eof
|
1934
|
+
alias_method :vi_eof_maybe, :vi_list_or_eof
|
1924
1935
|
|
1925
1936
|
private def ed_delete_next_char(key, arg: 1)
|
1926
1937
|
byte_size = Reline::Unicode.get_next_mbchar_size(@line, @byte_pointer)
|
data/lib/reline/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aycabta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: io-console
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
|
-
rubygems_version: 3.1.
|
115
|
+
rubygems_version: 3.1.2
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Alternative GNU Readline or Editline implementation by pure Ruby.
|