nvim 1.10.1 → 1.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6befdb7ddc3ff092b9cac368d4e245ce44e8322789559a752cb4633fe263a69c
4
- data.tar.gz: aec8cc511620f318618d577248318b7f9ee72ed40456aa3d8d71ae0f619be436
3
+ metadata.gz: 3fa0b55ca015155ce4b01c07c151deec0c3945b3d5733ec70afe8a915f5dc6fe
4
+ data.tar.gz: f8ac70647ad393bbd19eb6517ce36f2920e4a874c1646c370865cae2990582e3
5
5
  SHA512:
6
- metadata.gz: 9d382647096ceeba099c8cbfba73c0f150da1b2d61791374a4ca73de44fe195baecce3ac8bb84cd6a5beb68eb319d72970f9cc4ad8eb3d093255782807cbeac3
7
- data.tar.gz: 84902f55fd2bba21caf85926f31159d05d4559ee4fd20f23a063e2dde899052811a735b94f86a64ef3eca1a9d31ee5faf46d4fc58990747195773e5db6138ca1
6
+ metadata.gz: ad469a43c613193dd78fa23b18fb43aefed8d380ce43d3415ebb645a6c4414555436964ab6c2c122bea7b5e795fb3863dc8a5df12e361448527dd6a3551516a9
7
+ data.tar.gz: 0e539c2122399016f1e396aef2f7592b20632b75642574d710d93bdc0f6d18074aa8dd1f1a6e6b226bc663880764a5262d80c6ebca4bed93f6b399dafee83eca
data/INFO.yaml CHANGED
@@ -3,7 +3,7 @@
3
3
  #
4
4
 
5
5
  nvim:
6
- version: 1.10.1
6
+ version: "1.13"
7
7
  license: BSD-2-Clause+
8
8
  authors:
9
9
  - Bertram Scharpf
data/README.md CHANGED
@@ -147,7 +147,7 @@ To inhibit the output of the last value, set the
147
147
 
148
148
  #### Last return value
149
149
 
150
- The anonymous variable `_` will hold the last non-nil result.
150
+ The anonymous variable `_` will hold the last non-`nil` result.
151
151
 
152
152
  ```
153
153
  1 7*11*13
@@ -284,6 +284,28 @@ The legacy variables `$curbuf` and `$curwin` are supported.
284
284
  ```
285
285
 
286
286
 
287
+ ### Visit and change lines by :rubydo
288
+
289
+ The `$_` and `$.` variables contain the line itself and the line number.
290
+ `$_` may be changed or assigned to.
291
+
292
+ ```
293
+ :rubydo $_.strip! # unindent all
294
+ :rubydo $_.insert 0, "%4d " % $. # number lines
295
+ :rubydo i = i.to_i.succ ; $_ = "%4d %s" % [ i, $_] # dto.
296
+ ```
297
+
298
+ If `$_` is `nil`, the line will be deleted. If it is an `Enumerable`,
299
+ each element will be inserted as its own line. All other non-string
300
+ values will be converted by `#to_s`.
301
+
302
+ ```
303
+ :rubydo $_ = nil if $_ =~ /^#/ # delete comment lines
304
+ :rubydo $_ = $_.split # put each word on its own line
305
+ :rubydo $_ = [$_]*3 if ~/knock/i # triple lines containing /knock/
306
+ ```
307
+
308
+
287
309
  ### Requiring Ruby files
288
310
 
289
311
  In addition to the `:rubyfile` command as documented, that command can also be
data/lib/neovim/client.rb CHANGED
@@ -162,13 +162,9 @@ module Neovim
162
162
  each do |l|
163
163
  h = l.hash
164
164
  m = yield l, @i
165
- r =
166
- case m
167
- when String then m.lines unless m.hash == h
168
- when Enumerable then m.map { |l| l.to_s }
169
- when nil, false then []
170
- end
171
- if r then
165
+ if not String === m or m.hash != h then
166
+ r = result_strings m
167
+ r.flatten!
172
168
  r.each { |l| l.chomp! }
173
169
  @client.buf_set_lines @buffer, @i-1, @i, true, r
174
170
  @inc = r.length
@@ -177,6 +173,16 @@ module Neovim
177
173
  end
178
174
  end
179
175
 
176
+ private
177
+
178
+ def result_strings obj
179
+ case obj
180
+ when Enumerable then obj.map { |l| result_strings l }
181
+ when nil then []
182
+ else obj.to_s.lines
183
+ end
184
+ end
185
+
180
186
  end
181
187
 
182
188
  end
@@ -8,13 +8,28 @@ begin
8
8
  require "supplement/socket"
9
9
  rescue LoadError
10
10
  require "socket"
11
+ class BasicSocket
12
+ private def with_close socket
13
+ if block_given? then
14
+ begin
15
+ yield socket
16
+ ensure
17
+ socket.close
18
+ end
19
+ else
20
+ socket
21
+ end
22
+ end
23
+ end
11
24
  class TCPServer
12
25
  alias accept_orig accept
13
26
  private :accept_orig
14
- def accept
15
- a = accept_orig
16
- if block_given? then yield a else a end
17
- end
27
+ def accept &block ; with_close accept_orig, &block ; end
28
+ end
29
+ class UNIXServer
30
+ alias accept_orig accept
31
+ private :accept_orig
32
+ def accept &block ; with_close accept_orig, &block ; end
18
33
  end
19
34
  end
20
35
 
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.10.1",
3
+ version: "1.13",
4
4
  license: "BSD-2-Clause+",
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: "fa5cec3"
10
+ commit: "110ccd3"
data/lib/neovim/output.rb CHANGED
@@ -137,18 +137,14 @@ module Neovim
137
137
  end
138
138
 
139
139
  class WriteBuf < WriteStd
140
- def initialize *args, whole: nil, top: nil
140
+ def initialize *args, follow: nil
141
141
  super
142
142
  @lines = []
143
- @whole, @top = whole, top
143
+ @follow = follow.to_bool
144
144
  end
145
145
  def finish
146
146
  super
147
- if @whole then
148
- @client.buf_set_lines 0, 0, -1, true, @lines
149
- else
150
- @client.put @lines, "l", true, !@top
151
- end
147
+ @client.put @lines, "l", @follow, @follow
152
148
  end
153
149
  private
154
150
  def write_line l
@@ -12,7 +12,7 @@ module Neovim
12
12
 
13
13
  def result
14
14
  @result or return
15
- r = @decs ? (@result.round @decs) : @result
15
+ r = round @result
16
16
  case r
17
17
  when BigDecimal then
18
18
  r = r.to_s "F"
@@ -100,7 +100,7 @@ module Neovim
100
100
  def parse_number n
101
101
  n.strip!
102
102
  if n =~ %r/ *%\z/ then
103
- @prev * (BigDecimal $`) / 100
103
+ round @prev * (BigDecimal $`) / 100
104
104
  else
105
105
  comma! if not @sep and n =~ /\d,(?:-|\d+\b(?:[^.]|$))/
106
106
  if @sep == "," then n.gsub! ".", "_" ; n.sub! @sep, "."
@@ -117,6 +117,10 @@ module Neovim
117
117
  end
118
118
  end
119
119
 
120
+ def round x
121
+ @decs ? (x.round @decs) : x
122
+ end
123
+
120
124
  end
121
125
 
122
126
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nvim
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1
4
+ version: '1.13'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubygems_version: 3.6.7
82
+ rubygems_version: 3.7.1
83
83
  specification_version: 4
84
84
  summary: Yet another Ruby client for Neovim
85
85
  test_files: []