reline 0.1.9 → 0.2.3
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.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/reline.rb +25 -5
- data/lib/reline/ansi.rb +44 -3
- data/lib/reline/config.rb +9 -7
- data/lib/reline/key_actor/emacs.rb +1 -1
- data/lib/reline/kill_ring.rb +12 -0
- data/lib/reline/line_editor.rb +498 -221
- data/lib/reline/line_editor.rb.orig +2696 -0
- data/lib/reline/unicode.rb +5 -4
- data/lib/reline/version.rb +1 -1
- data/lib/reline/windows.rb +9 -1
- data/license_of_rb-readline +25 -0
- metadata +5 -3
data/lib/reline/unicode.rb
CHANGED
@@ -458,8 +458,8 @@ class Reline::Unicode
|
|
458
458
|
[byte_size, width]
|
459
459
|
end
|
460
460
|
|
461
|
-
def self.vi_forward_word(line, byte_pointer)
|
462
|
-
if
|
461
|
+
def self.vi_forward_word(line, byte_pointer, drop_terminate_spaces = false)
|
462
|
+
if line.bytesize > byte_pointer
|
463
463
|
size = get_next_mbchar_size(line, byte_pointer)
|
464
464
|
mbchar = line.byteslice(byte_pointer, size)
|
465
465
|
if mbchar =~ /\w/
|
@@ -474,7 +474,7 @@ class Reline::Unicode
|
|
474
474
|
else
|
475
475
|
return [0, 0]
|
476
476
|
end
|
477
|
-
while
|
477
|
+
while line.bytesize > (byte_pointer + byte_size)
|
478
478
|
size = get_next_mbchar_size(line, byte_pointer + byte_size)
|
479
479
|
mbchar = line.byteslice(byte_pointer + byte_size, size)
|
480
480
|
case started_by
|
@@ -488,7 +488,8 @@ class Reline::Unicode
|
|
488
488
|
width += get_mbchar_width(mbchar)
|
489
489
|
byte_size += size
|
490
490
|
end
|
491
|
-
|
491
|
+
return [byte_size, width] if drop_terminate_spaces
|
492
|
+
while line.bytesize > (byte_pointer + byte_size)
|
492
493
|
size = get_next_mbchar_size(line, byte_pointer + byte_size)
|
493
494
|
mbchar = line.byteslice(byte_pointer + byte_size, size)
|
494
495
|
break if mbchar =~ /\S/
|
data/lib/reline/version.rb
CHANGED
data/lib/reline/windows.rb
CHANGED
@@ -233,7 +233,9 @@ class Reline::Windows
|
|
233
233
|
|
234
234
|
def self.move_cursor_up(val)
|
235
235
|
if val > 0
|
236
|
-
|
236
|
+
y = cursor_pos.y - val
|
237
|
+
y = 0 if y < 0
|
238
|
+
@@SetConsoleCursorPosition.call(@@hConsoleHandle, y * 65536 + cursor_pos.x)
|
237
239
|
elsif val < 0
|
238
240
|
move_cursor_down(-val)
|
239
241
|
end
|
@@ -241,6 +243,9 @@ class Reline::Windows
|
|
241
243
|
|
242
244
|
def self.move_cursor_down(val)
|
243
245
|
if val > 0
|
246
|
+
screen_height = get_screen_size.first
|
247
|
+
y = cursor_pos.y + val
|
248
|
+
y = screen_height - 1 if y > (screen_height - 1)
|
244
249
|
@@SetConsoleCursorPosition.call(@@hConsoleHandle, (cursor_pos.y + val) * 65536 + cursor_pos.x)
|
245
250
|
elsif val < 0
|
246
251
|
move_cursor_up(-val)
|
@@ -253,10 +258,13 @@ class Reline::Windows
|
|
253
258
|
cursor = csbi[4, 4].unpack('L').first
|
254
259
|
written = 0.chr * 4
|
255
260
|
@@FillConsoleOutputCharacter.call(@@hConsoleHandle, 0x20, get_screen_size.last - cursor_pos.x, cursor, written)
|
261
|
+
@@FillConsoleOutputAttribute.call(@@hConsoleHandle, 0, get_screen_size.last - cursor_pos.x, cursor, written)
|
256
262
|
end
|
257
263
|
|
258
264
|
def self.scroll_down(val)
|
259
265
|
return if val.zero?
|
266
|
+
screen_height = get_screen_size.first
|
267
|
+
val = screen_height - 1 if val > (screen_height - 1)
|
260
268
|
scroll_rectangle = [0, val, get_screen_size.last, get_screen_size.first].pack('s4')
|
261
269
|
destination_origin = 0 # y * 65536 + x
|
262
270
|
fill = [' '.ord, 0].pack('SS')
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Copyright (c) 2009, Park Heesob
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
* Neither the name of Park Heesob nor the names of its contributors
|
13
|
+
may be used to endorse or promote products derived from this software
|
14
|
+
without specific prior written permission.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
17
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
20
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
21
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
24
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
25
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
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.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aycabta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: io-console
|
@@ -103,11 +103,13 @@ files:
|
|
103
103
|
- lib/reline/key_stroke.rb
|
104
104
|
- lib/reline/kill_ring.rb
|
105
105
|
- lib/reline/line_editor.rb
|
106
|
+
- lib/reline/line_editor.rb.orig
|
106
107
|
- lib/reline/sibori.rb
|
107
108
|
- lib/reline/unicode.rb
|
108
109
|
- lib/reline/unicode/east_asian_width.rb
|
109
110
|
- lib/reline/version.rb
|
110
111
|
- lib/reline/windows.rb
|
112
|
+
- license_of_rb-readline
|
111
113
|
homepage: https://github.com/ruby/reline
|
112
114
|
licenses:
|
113
115
|
- Ruby
|
@@ -127,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
129
|
- !ruby/object:Gem::Version
|
128
130
|
version: '0'
|
129
131
|
requirements: []
|
130
|
-
rubygems_version: 3.1.
|
132
|
+
rubygems_version: 3.1.4
|
131
133
|
signing_key:
|
132
134
|
specification_version: 4
|
133
135
|
summary: Alternative GNU Readline or Editline implementation by pure Ruby.
|