nvim 1.13.4 → 1.14.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.
- checksums.yaml +4 -4
- data/INFO.yaml +1 -1
- data/README.md +1 -1
- data/lib/neovim/client.rb +48 -29
- data/lib/neovim/info.rb +2 -2
- data/lib/neovim/remote_object.rb +65 -37
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4df34be40dc780445a8534b01d98c59ad0bc0ab05da727e2f40d8a95c74f765c
|
|
4
|
+
data.tar.gz: 665cf4edbaee51945bf2940dcb2a1123bf79009bef29b8335d4e965206cb2c70
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62589684b7ea686899543001bd5f9e27566c1464e7ffda212ac2d4ad1f383bf4386fecaa3e3626844c9cb025bdc9eab1ed3276cf889eb82bfab85c7d2efef8c3
|
|
7
|
+
data.tar.gz: 636cc302ddefadd6e9c4daa7b807da7b0254eec09804ca0b3efd9c5b32228db0901a10a7d25683c3b046f81408cf6685c2c3f4c00a78086756b3e04c7fc10272
|
data/INFO.yaml
CHANGED
data/README.md
CHANGED
|
@@ -310,7 +310,7 @@ values will be converted by `#to_s`.
|
|
|
310
310
|
### Requiring Ruby files
|
|
311
311
|
|
|
312
312
|
In addition to the `:rubyfile` command as documented, that command can also be
|
|
313
|
-
used to just require a Ruby file.
|
|
313
|
+
used to just require a Ruby file. Put the name into angle brackets, and the
|
|
314
314
|
file will be searched in `$:`. Sorry, file name completion will not work.
|
|
315
315
|
|
|
316
316
|
```
|
data/lib/neovim/client.rb
CHANGED
|
@@ -129,11 +129,11 @@ module Neovim
|
|
|
129
129
|
when Buffer then @client, @buffer = client.client, client.index
|
|
130
130
|
else @client, @buffer = client, 0
|
|
131
131
|
end
|
|
132
|
-
@
|
|
132
|
+
@first, @last = range.begin, range.end
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
def to_s
|
|
136
|
-
(@client.buf_get_lines @buffer, @
|
|
136
|
+
(@client.buf_get_lines @buffer, @first-1, @last, true).join $/
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
def method_missing sym, *args, **kwargs, &block
|
|
@@ -141,46 +141,65 @@ module Neovim
|
|
|
141
141
|
end
|
|
142
142
|
|
|
143
143
|
def each
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
if block_given? then
|
|
145
|
+
begin
|
|
146
|
+
@i = @first
|
|
147
|
+
while @i <= @last do
|
|
148
|
+
l, = @client.buf_get_lines @buffer, @i-1, @i, true
|
|
149
|
+
yield l, @i
|
|
150
|
+
@i += 1
|
|
151
|
+
end
|
|
152
|
+
ensure
|
|
153
|
+
@i = nil
|
|
154
|
+
end
|
|
155
|
+
else
|
|
156
|
+
Enumerator.new { |y| each { |l,i| y.yield l, i } }
|
|
149
157
|
end
|
|
150
|
-
ensure
|
|
151
|
-
@i = nil
|
|
152
158
|
end
|
|
153
159
|
alias each_line each
|
|
154
160
|
|
|
155
|
-
def
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
def map!
|
|
162
|
+
if block_given? then
|
|
163
|
+
each do |l|
|
|
164
|
+
h = l.hash
|
|
165
|
+
m = yield l, @i
|
|
166
|
+
if m.hash != h or m != l then
|
|
167
|
+
r = Neovim.result_lines m
|
|
168
|
+
@client.buf_set_lines @buffer, @i-1, @i, true, r
|
|
169
|
+
inc = r.length - 1
|
|
170
|
+
@i += inc
|
|
171
|
+
@last += inc
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
else
|
|
175
|
+
Enumerator.new { |y| map! { |l,i| y.yield l, i } }
|
|
158
176
|
end
|
|
159
177
|
end
|
|
178
|
+
alias collect! map!
|
|
160
179
|
|
|
161
|
-
def
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
@inc = r.length
|
|
170
|
-
@last += @inc-1
|
|
180
|
+
def reject!
|
|
181
|
+
if block_given? then
|
|
182
|
+
each do |l|
|
|
183
|
+
if yield l, @i then
|
|
184
|
+
@client.buf_set_lines @buffer, @i-1, @i, true, []
|
|
185
|
+
@i -= 1
|
|
186
|
+
@last -= 1
|
|
187
|
+
end
|
|
171
188
|
end
|
|
189
|
+
else
|
|
190
|
+
Enumerator.new { |y| reject! { |l,i| y.yield l, i } }
|
|
172
191
|
end
|
|
173
192
|
end
|
|
193
|
+
alias delete_if reject!
|
|
174
194
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
when nil then []
|
|
181
|
-
else obj.to_s.scan /^.*$/
|
|
195
|
+
def select!
|
|
196
|
+
if block_given? then
|
|
197
|
+
reject! { |l,i| not (yield l, i) }
|
|
198
|
+
else
|
|
199
|
+
Enumerator.new { |y| select! { |l,i| y.yield l, i } }
|
|
182
200
|
end
|
|
183
201
|
end
|
|
202
|
+
alias filter! select!
|
|
184
203
|
|
|
185
204
|
end
|
|
186
205
|
|
data/lib/neovim/info.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
require "neovim/meta.rb"
|
|
2
2
|
Neovim::INFO = Neovim::Meta.new "nvim",
|
|
3
|
-
version: "1.
|
|
3
|
+
version: "1.14.1",
|
|
4
4
|
license: "LicenseRef-BSD-2-Clause-and-DECENT_LANGUAGE",
|
|
5
5
|
authors: ["Bertram Scharpf"],
|
|
6
6
|
email: "software@bertram-scharpf.de",
|
|
7
7
|
summary: "Yet another Ruby client for Neovim",
|
|
8
8
|
description: "A simple Ruby client for Neovim.\nClean code, minimal dependecies, no frills, no wokeness.",
|
|
9
9
|
homepage: "https://github.com/BertramScharpf/ruby-nvim",
|
|
10
|
-
commit: "
|
|
10
|
+
commit: "5b9a1c2"
|
data/lib/neovim/remote_object.rb
CHANGED
|
@@ -147,7 +147,7 @@ module Neovim
|
|
|
147
147
|
|
|
148
148
|
def []= pos = nil, len = nil, str
|
|
149
149
|
line_indices pos, len do |fst,lst|
|
|
150
|
-
set_lines fst, lst, false, (
|
|
150
|
+
set_lines fst, lst, false, (Neovim.result_lines str)
|
|
151
151
|
end
|
|
152
152
|
self
|
|
153
153
|
end
|
|
@@ -193,36 +193,61 @@ module Neovim
|
|
|
193
193
|
include Enumerable
|
|
194
194
|
|
|
195
195
|
def each pos = nil, len = nil, &block
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
if block_given? then
|
|
197
|
+
iter_chunks pos, len do |l|
|
|
198
|
+
l.each &block
|
|
199
|
+
end
|
|
200
|
+
else
|
|
201
|
+
Enumerator.new { |y| each { |x,i| y.yield x, i } }
|
|
198
202
|
end
|
|
199
203
|
end
|
|
200
204
|
|
|
201
205
|
def map! pos = nil, len = nil, &block
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
206
|
+
if block_given? then
|
|
207
|
+
iter_chunks pos, len do |l|
|
|
208
|
+
n = l.length
|
|
209
|
+
h = l.hash
|
|
210
|
+
m = l.map &block
|
|
211
|
+
if m.hash != h or m != l then
|
|
212
|
+
r = Neovim.result_lines m
|
|
213
|
+
set_lines @fst, @fst+n, true, r
|
|
214
|
+
inc = r.length - n
|
|
215
|
+
@fst += inc
|
|
216
|
+
@lst += inc
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
else
|
|
220
|
+
Enumerator.new { |y| map! { |x,i| y.yield x, i } }
|
|
205
221
|
end
|
|
206
222
|
end
|
|
223
|
+
alias collect! map!
|
|
207
224
|
|
|
208
|
-
def
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
225
|
+
def reject! pos = nil, len = nil, &block
|
|
226
|
+
if block_given? then
|
|
227
|
+
iter_chunks pos, len do |l|
|
|
228
|
+
n = l.length
|
|
229
|
+
l.reject! &block
|
|
230
|
+
if l.length < n then
|
|
231
|
+
set_lines @fst, @fst+n, true, l
|
|
232
|
+
inc = l.length - n
|
|
233
|
+
@fst += inc
|
|
234
|
+
@lst += inc
|
|
217
235
|
end
|
|
218
236
|
end
|
|
237
|
+
else
|
|
238
|
+
Enumerator.new { |y| map! { |x,i| y.yield x, i } }
|
|
219
239
|
end
|
|
220
240
|
end
|
|
241
|
+
alias delete_if reject!
|
|
221
242
|
|
|
222
|
-
def
|
|
223
|
-
|
|
243
|
+
def select!
|
|
244
|
+
if block_given? then
|
|
245
|
+
reject! { |l| not (yield l) }
|
|
246
|
+
else
|
|
247
|
+
Enumerator.new { |y| select! { |l| y.yield l } }
|
|
248
|
+
end
|
|
224
249
|
end
|
|
225
|
-
|
|
250
|
+
alias filter! select!
|
|
226
251
|
|
|
227
252
|
# Don't run into `method_missing`.
|
|
228
253
|
def get_lines fst, lst, strict ; call_obj :get_lines, fst, lst, strict ; end
|
|
@@ -262,32 +287,22 @@ module Neovim
|
|
|
262
287
|
end
|
|
263
288
|
end
|
|
264
289
|
|
|
265
|
-
@
|
|
290
|
+
@chunk_length = 1024
|
|
266
291
|
class <<self
|
|
267
|
-
attr_accessor :
|
|
292
|
+
attr_accessor :chunk_length
|
|
268
293
|
end
|
|
269
294
|
|
|
270
295
|
def iter_chunks pos, len
|
|
271
296
|
line_indices_positive pos, len do |fst,lst|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
yield fst, nxt
|
|
278
|
-
fst = nxt
|
|
297
|
+
@fst, @lst = fst, lst
|
|
298
|
+
while @fst < @lst do
|
|
299
|
+
l = get_lines @fst, @fst+self.class.chunk_length, false
|
|
300
|
+
yield l
|
|
301
|
+
@fst += self.class.chunk_length
|
|
279
302
|
end
|
|
280
303
|
end
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
def str_lines str
|
|
284
|
-
if Array === str then
|
|
285
|
-
str
|
|
286
|
-
elsif str.nil? then
|
|
287
|
-
[]
|
|
288
|
-
else
|
|
289
|
-
str.lines.each { |l| l.chomp! }
|
|
290
|
-
end
|
|
304
|
+
ensure
|
|
305
|
+
@fst = @lst = nil
|
|
291
306
|
end
|
|
292
307
|
|
|
293
308
|
end
|
|
@@ -330,5 +345,18 @@ module Neovim
|
|
|
330
345
|
|
|
331
346
|
end
|
|
332
347
|
|
|
348
|
+
|
|
349
|
+
class <<self
|
|
350
|
+
|
|
351
|
+
def result_lines obj
|
|
352
|
+
case obj
|
|
353
|
+
when Enumerable then obj.inject [] do |s,l| s.push *(result_lines l) end
|
|
354
|
+
when nil then []
|
|
355
|
+
else obj.to_s.scan /^.*$/
|
|
356
|
+
end
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
end
|
|
360
|
+
|
|
333
361
|
end
|
|
334
362
|
|