neovim 0.4.0 → 0.5.0
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/.gitignore +1 -1
- data/.gitmodules +1 -1
- data/.rspec +1 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +8 -0
- data/README.md +5 -3
- data/Rakefile +14 -8
- data/lib/neovim/buffer.rb +86 -114
- data/lib/neovim/client.rb +105 -103
- data/lib/neovim/current.rb +8 -18
- data/lib/neovim/executable.rb +2 -2
- data/lib/neovim/line_range.rb +48 -59
- data/lib/neovim/plugin/dsl.rb +11 -3
- data/lib/neovim/remote_object.rb +3 -13
- data/lib/neovim/ruby_provider.rb +3 -3
- data/lib/neovim/ruby_provider/buffer_ext.rb +3 -3
- data/lib/neovim/ruby_provider/vim.rb +2 -2
- data/lib/neovim/ruby_provider/window_ext.rb +3 -3
- data/lib/neovim/session.rb +4 -4
- data/lib/neovim/session/api.rb +50 -22
- data/lib/neovim/tabpage.rb +29 -19
- data/lib/neovim/version.rb +1 -1
- data/lib/neovim/window.rb +60 -40
- data/script/dump_api +1 -1
- data/script/generate_docs +35 -22
- data/spec/helper.rb +3 -1
- data/spec/integration/rplugin_autocmd_spec.vim +18 -0
- data/spec/integration/rplugin_command_spec.vim +97 -0
- data/spec/integration/rplugin_function_spec.vim +26 -0
- data/spec/integration/ruby_buffer_spec.rb +151 -0
- data/spec/{acceptance → integration}/ruby_spec.vim +2 -22
- data/spec/integration/ruby_vim_spec.rb +27 -0
- data/spec/integration/ruby_window_spec.rb +56 -0
- data/spec/{acceptance → integration}/rubydo_spec.vim +27 -18
- data/spec/{acceptance → integration}/rubyfile/call_foo.rb +0 -0
- data/spec/{acceptance → integration}/rubyfile/curbuf_ivar_get.rb +0 -0
- data/spec/{acceptance → integration}/rubyfile/curbuf_ivar_set.rb +0 -0
- data/spec/{acceptance → integration}/rubyfile/define_foo.rb +0 -0
- data/spec/{acceptance → integration}/rubyfile/raise_standard_error.rb +0 -0
- data/spec/{acceptance → integration}/rubyfile/raise_syntax_error.rb +0 -0
- data/spec/{acceptance → integration}/rubyfile/set_pwd_after.rb +0 -0
- data/spec/{acceptance → integration}/rubyfile/set_pwd_before.rb +0 -0
- data/spec/{acceptance → integration}/rubyfile_spec.vim +12 -30
- data/spec/integration/runtime/init.vim +9 -0
- data/spec/integration/runtime/rplugin/ruby/autocmds.rb +9 -0
- data/spec/integration/runtime/rplugin/ruby/commands.rb +59 -0
- data/spec/integration/runtime/rplugin/ruby/functions.rb +17 -0
- data/spec/integration_spec.rb +119 -0
- data/spec/neovim/buffer_spec.rb +0 -167
- data/spec/neovim/client_spec.rb +1 -44
- data/spec/neovim/current_spec.rb +0 -8
- data/spec/neovim/line_range_spec.rb +92 -97
- data/spec/neovim/plugin_spec.rb +14 -2
- data/spec/neovim/remote_object_spec.rb +4 -4
- data/spec/neovim/ruby_provider/buffer_ext_spec.rb +3 -3
- data/spec/neovim/ruby_provider/window_ext_spec.rb +1 -1
- data/spec/neovim/session/api_spec.rb +40 -35
- data/spec/neovim/session/event_loop_spec.rb +1 -1
- data/spec/neovim/session_spec.rb +15 -15
- metadata +49 -41
- data/script/acceptance_tests +0 -46
- data/spec/acceptance/rplugin_spec.vim +0 -19
- data/spec/acceptance/rubyfile/curbuf.rb +0 -1
- data/spec/acceptance/rubyfile/curwin.rb +0 -1
- data/spec/acceptance/rubyfile/vim_constants.rb +0 -2
- data/spec/acceptance/runtime/init.vim +0 -1
- data/spec/acceptance/runtime/rplugin/ruby/plugin.rb +0 -13
- data/spec/documentation_spec.rb +0 -24
- data/spec/neovim/window_spec.rb +0 -91
@@ -83,7 +83,7 @@ module Neovim
|
|
83
83
|
context "child" do
|
84
84
|
it "sends and receives data" do
|
85
85
|
event_loop = EventLoop.child(Support.child_argv)
|
86
|
-
input = MessagePack.pack([0, 0, :
|
86
|
+
input = MessagePack.pack([0, 0, :nvim_strwidth, ["hi"]])
|
87
87
|
|
88
88
|
response = nil
|
89
89
|
event_loop.write(input).run do |msg|
|
data/spec/neovim/session_spec.rb
CHANGED
@@ -17,56 +17,56 @@ module Neovim
|
|
17
17
|
|
18
18
|
describe "#request" do
|
19
19
|
it "synchronously returns a result" do
|
20
|
-
expect(session.request(:
|
20
|
+
expect(session.request(:nvim_strwidth, "foobar")).to be(6)
|
21
21
|
end
|
22
22
|
|
23
23
|
it "raises an exception when there are errors" do
|
24
24
|
expect {
|
25
|
-
session.request(:
|
25
|
+
session.request(:nvim_strwidth, "too", "many")
|
26
26
|
}.to raise_error(/wrong number of arguments/i)
|
27
27
|
end
|
28
28
|
|
29
29
|
it "handles large data" do
|
30
30
|
large_str = Array.new(1024 * 17) { SecureRandom.hex(1) }.join
|
31
|
-
session.request(:
|
32
|
-
expect(session.request(:
|
31
|
+
session.request(:nvim_set_current_line, large_str)
|
32
|
+
expect(session.request(:nvim_get_current_line)).to eq(large_str)
|
33
33
|
end
|
34
34
|
|
35
35
|
it "fails outside of the main thread" do
|
36
36
|
expect {
|
37
|
-
Thread.new { session.request(:
|
37
|
+
Thread.new { session.request(:nvim_strwidth, "foo") }.join
|
38
38
|
}.to raise_error(/outside of the main thread/)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "#notify" do
|
43
43
|
it "returns nil" do
|
44
|
-
expect(session.notify(:
|
44
|
+
expect(session.notify(:nvim_input, "jk")).to be(nil)
|
45
45
|
end
|
46
46
|
|
47
47
|
it "doesn't raise exceptions" do
|
48
48
|
expect {
|
49
|
-
session.notify(:
|
49
|
+
session.notify(:nvim_strwidth, "too", "many")
|
50
50
|
}.not_to raise_error
|
51
51
|
end
|
52
52
|
|
53
53
|
it "handles large data" do
|
54
54
|
large_str = Array.new(1024 * 17) { SecureRandom.hex(1) }.join
|
55
|
-
session.notify(:
|
56
|
-
expect(session.request(:
|
55
|
+
session.notify(:nvim_set_current_line, large_str)
|
56
|
+
expect(session.request(:nvim_get_current_line)).to eq(large_str)
|
57
57
|
end
|
58
58
|
|
59
59
|
it "fails outside of the main thread" do
|
60
60
|
expect {
|
61
|
-
Thread.new { session.notify(:
|
61
|
+
Thread.new { session.notify(:nvim_set_current_line, "foo") }.join
|
62
62
|
}.to raise_error(/outside of the main thread/)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
describe "#run" do
|
67
67
|
it "enqueues messages received during blocking requests" do
|
68
|
-
session.request(:
|
69
|
-
session.request(:
|
68
|
+
session.request(:nvim_subscribe, "my_event")
|
69
|
+
session.request(:nvim_command, "call rpcnotify(0, 'my_event', 'foo')")
|
70
70
|
|
71
71
|
message = nil
|
72
72
|
session.run do |msg|
|
@@ -80,12 +80,12 @@ module Neovim
|
|
80
80
|
end
|
81
81
|
|
82
82
|
it "supports requests within callbacks" do
|
83
|
-
session.request(:
|
84
|
-
session.request(:
|
83
|
+
session.request(:nvim_subscribe, "my_event")
|
84
|
+
session.request(:nvim_command, "call rpcnotify(0, 'my_event', 'foo')")
|
85
85
|
|
86
86
|
result = nil
|
87
87
|
session.run do |msg|
|
88
|
-
result = session.request(:
|
88
|
+
result = session.request(:nvim_strwidth, msg.arguments.first)
|
89
89
|
session.shutdown
|
90
90
|
end
|
91
91
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neovim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Genco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- ".coveralls.yml"
|
92
92
|
- ".gitignore"
|
93
93
|
- ".gitmodules"
|
94
|
+
- ".rspec"
|
94
95
|
- ".travis.yml"
|
95
96
|
- CHANGELOG.md
|
96
97
|
- Gemfile
|
@@ -126,30 +127,34 @@ files:
|
|
126
127
|
- lib/neovim/version.rb
|
127
128
|
- lib/neovim/window.rb
|
128
129
|
- neovim.gemspec
|
129
|
-
- script/acceptance_tests
|
130
130
|
- script/dump_api
|
131
131
|
- script/generate_docs
|
132
132
|
- script/j2mp
|
133
133
|
- script/mp2j
|
134
|
-
- spec/acceptance/rplugin_spec.vim
|
135
|
-
- spec/acceptance/ruby_spec.vim
|
136
|
-
- spec/acceptance/rubydo_spec.vim
|
137
|
-
- spec/acceptance/rubyfile/call_foo.rb
|
138
|
-
- spec/acceptance/rubyfile/curbuf.rb
|
139
|
-
- spec/acceptance/rubyfile/curbuf_ivar_get.rb
|
140
|
-
- spec/acceptance/rubyfile/curbuf_ivar_set.rb
|
141
|
-
- spec/acceptance/rubyfile/curwin.rb
|
142
|
-
- spec/acceptance/rubyfile/define_foo.rb
|
143
|
-
- spec/acceptance/rubyfile/raise_standard_error.rb
|
144
|
-
- spec/acceptance/rubyfile/raise_syntax_error.rb
|
145
|
-
- spec/acceptance/rubyfile/set_pwd_after.rb
|
146
|
-
- spec/acceptance/rubyfile/set_pwd_before.rb
|
147
|
-
- spec/acceptance/rubyfile/vim_constants.rb
|
148
|
-
- spec/acceptance/rubyfile_spec.vim
|
149
|
-
- spec/acceptance/runtime/init.vim
|
150
|
-
- spec/acceptance/runtime/rplugin/ruby/plugin.rb
|
151
|
-
- spec/documentation_spec.rb
|
152
134
|
- spec/helper.rb
|
135
|
+
- spec/integration/rplugin_autocmd_spec.vim
|
136
|
+
- spec/integration/rplugin_command_spec.vim
|
137
|
+
- spec/integration/rplugin_function_spec.vim
|
138
|
+
- spec/integration/ruby_buffer_spec.rb
|
139
|
+
- spec/integration/ruby_spec.vim
|
140
|
+
- spec/integration/ruby_vim_spec.rb
|
141
|
+
- spec/integration/ruby_window_spec.rb
|
142
|
+
- spec/integration/rubydo_spec.vim
|
143
|
+
- spec/integration/rubyfile/call_foo.rb
|
144
|
+
- spec/integration/rubyfile/curbuf_ivar_get.rb
|
145
|
+
- spec/integration/rubyfile/curbuf_ivar_set.rb
|
146
|
+
- spec/integration/rubyfile/define_foo.rb
|
147
|
+
- spec/integration/rubyfile/raise_standard_error.rb
|
148
|
+
- spec/integration/rubyfile/raise_syntax_error.rb
|
149
|
+
- spec/integration/rubyfile/set_pwd_after.rb
|
150
|
+
- spec/integration/rubyfile/set_pwd_before.rb
|
151
|
+
- spec/integration/rubyfile_spec.vim
|
152
|
+
- spec/integration/runtime/init.vim
|
153
|
+
- spec/integration/runtime/rplugin.vim
|
154
|
+
- spec/integration/runtime/rplugin/ruby/autocmds.rb
|
155
|
+
- spec/integration/runtime/rplugin/ruby/commands.rb
|
156
|
+
- spec/integration/runtime/rplugin/ruby/functions.rb
|
157
|
+
- spec/integration_spec.rb
|
153
158
|
- spec/neovim/buffer_spec.rb
|
154
159
|
- spec/neovim/client_spec.rb
|
155
160
|
- spec/neovim/current_spec.rb
|
@@ -170,7 +175,6 @@ files:
|
|
170
175
|
- spec/neovim/session/rpc_spec.rb
|
171
176
|
- spec/neovim/session/serializer_spec.rb
|
172
177
|
- spec/neovim/session_spec.rb
|
173
|
-
- spec/neovim/window_spec.rb
|
174
178
|
- spec/neovim_spec.rb
|
175
179
|
- spec/support.rb
|
176
180
|
homepage: https://github.com/alexgenco/neovim-ruby
|
@@ -198,25 +202,30 @@ signing_key:
|
|
198
202
|
specification_version: 4
|
199
203
|
summary: A Ruby client for Neovim
|
200
204
|
test_files:
|
201
|
-
- spec/acceptance/rplugin_spec.vim
|
202
|
-
- spec/acceptance/ruby_spec.vim
|
203
|
-
- spec/acceptance/rubydo_spec.vim
|
204
|
-
- spec/acceptance/rubyfile/call_foo.rb
|
205
|
-
- spec/acceptance/rubyfile/curbuf.rb
|
206
|
-
- spec/acceptance/rubyfile/curbuf_ivar_get.rb
|
207
|
-
- spec/acceptance/rubyfile/curbuf_ivar_set.rb
|
208
|
-
- spec/acceptance/rubyfile/curwin.rb
|
209
|
-
- spec/acceptance/rubyfile/define_foo.rb
|
210
|
-
- spec/acceptance/rubyfile/raise_standard_error.rb
|
211
|
-
- spec/acceptance/rubyfile/raise_syntax_error.rb
|
212
|
-
- spec/acceptance/rubyfile/set_pwd_after.rb
|
213
|
-
- spec/acceptance/rubyfile/set_pwd_before.rb
|
214
|
-
- spec/acceptance/rubyfile/vim_constants.rb
|
215
|
-
- spec/acceptance/rubyfile_spec.vim
|
216
|
-
- spec/acceptance/runtime/init.vim
|
217
|
-
- spec/acceptance/runtime/rplugin/ruby/plugin.rb
|
218
|
-
- spec/documentation_spec.rb
|
219
205
|
- spec/helper.rb
|
206
|
+
- spec/integration/rplugin_autocmd_spec.vim
|
207
|
+
- spec/integration/rplugin_command_spec.vim
|
208
|
+
- spec/integration/rplugin_function_spec.vim
|
209
|
+
- spec/integration/ruby_buffer_spec.rb
|
210
|
+
- spec/integration/ruby_spec.vim
|
211
|
+
- spec/integration/ruby_vim_spec.rb
|
212
|
+
- spec/integration/ruby_window_spec.rb
|
213
|
+
- spec/integration/rubydo_spec.vim
|
214
|
+
- spec/integration/rubyfile/call_foo.rb
|
215
|
+
- spec/integration/rubyfile/curbuf_ivar_get.rb
|
216
|
+
- spec/integration/rubyfile/curbuf_ivar_set.rb
|
217
|
+
- spec/integration/rubyfile/define_foo.rb
|
218
|
+
- spec/integration/rubyfile/raise_standard_error.rb
|
219
|
+
- spec/integration/rubyfile/raise_syntax_error.rb
|
220
|
+
- spec/integration/rubyfile/set_pwd_after.rb
|
221
|
+
- spec/integration/rubyfile/set_pwd_before.rb
|
222
|
+
- spec/integration/rubyfile_spec.vim
|
223
|
+
- spec/integration/runtime/init.vim
|
224
|
+
- spec/integration/runtime/rplugin.vim
|
225
|
+
- spec/integration/runtime/rplugin/ruby/autocmds.rb
|
226
|
+
- spec/integration/runtime/rplugin/ruby/commands.rb
|
227
|
+
- spec/integration/runtime/rplugin/ruby/functions.rb
|
228
|
+
- spec/integration_spec.rb
|
220
229
|
- spec/neovim/buffer_spec.rb
|
221
230
|
- spec/neovim/client_spec.rb
|
222
231
|
- spec/neovim/current_spec.rb
|
@@ -237,6 +246,5 @@ test_files:
|
|
237
246
|
- spec/neovim/session/rpc_spec.rb
|
238
247
|
- spec/neovim/session/serializer_spec.rb
|
239
248
|
- spec/neovim/session_spec.rb
|
240
|
-
- spec/neovim/window_spec.rb
|
241
249
|
- spec/neovim_spec.rb
|
242
250
|
- spec/support.rb
|
data/script/acceptance_tests
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
$:.unshift File.expand_path("../../lib", __FILE__)
|
5
|
-
|
6
|
-
require "neovim"
|
7
|
-
require "shellwords"
|
8
|
-
require "tempfile"
|
9
|
-
require File.expand_path("../../spec/support.rb", __FILE__)
|
10
|
-
|
11
|
-
nvim = Neovim.executable.path
|
12
|
-
vader = File.expand_path("../../vendor/vader.vim", __FILE__)
|
13
|
-
specs = File.expand_path("../../spec/acceptance/*_spec.vim", __FILE__)
|
14
|
-
root = File.expand_path("../..", __FILE__)
|
15
|
-
exitstatus = 0
|
16
|
-
|
17
|
-
Dir.glob(specs) do |vader_spec|
|
18
|
-
Tempfile.open("vader.out") do |tmp|
|
19
|
-
Dir.chdir(root) do
|
20
|
-
system(
|
21
|
-
{
|
22
|
-
"VADER_OUTPUT_FILE" => tmp.path,
|
23
|
-
"NVIM_RPLUGIN_MANIFEST" => "spec/acceptance/runtime/rplugin.vim"
|
24
|
-
},
|
25
|
-
"bash", "-c",
|
26
|
-
"#{nvim} --headless -nu spec/acceptance/runtime/init.vim +'Vader! #{vader_spec}'"
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
if $?.success?
|
31
|
-
puts "[✔] #{vader_spec}"
|
32
|
-
else
|
33
|
-
exitstatus = $?.exitstatus
|
34
|
-
IO.copy_stream(tmp, $stderr)
|
35
|
-
puts "[✘] #{vader_spec}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
if exitstatus == 0
|
41
|
-
puts "[✔] Acceptance tests passed."
|
42
|
-
else
|
43
|
-
puts "[✘] Acceptance tests failed."
|
44
|
-
end
|
45
|
-
|
46
|
-
exit(exitstatus)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
Given:
|
2
|
-
one
|
3
|
-
two
|
4
|
-
|
5
|
-
Execute (Update remote plugins):
|
6
|
-
silent UpdateRemotePlugins
|
7
|
-
|
8
|
-
Execute (Call rplugin command):
|
9
|
-
PlugSetFoo bar
|
10
|
-
sleep 100m
|
11
|
-
AssertEqual "bar", g:PlugFoo
|
12
|
-
|
13
|
-
Execute (Call rplugin function):
|
14
|
-
AssertEqual 3, PlugAdd(1, 2)
|
15
|
-
|
16
|
-
Execute (Trigger rplugin autocmd):
|
17
|
-
silent edit foo.rb
|
18
|
-
sleep 100m
|
19
|
-
AssertEqual 1, g:PlugInRuby
|
@@ -1 +0,0 @@
|
|
1
|
-
$curbuf[1] = "first"
|
@@ -1 +0,0 @@
|
|
1
|
-
$curwin.buffer[1] = "first"
|
@@ -1 +0,0 @@
|
|
1
|
-
set rtp=vendor/vader.vim,spec/acceptance/runtime,$VIMRUNTIME
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Neovim.plugin do |plug|
|
2
|
-
plug.command(:PlugSetFoo, :nargs => 1) do |nvim, str|
|
3
|
-
nvim.command("let g:PlugFoo = '#{str}'")
|
4
|
-
end
|
5
|
-
|
6
|
-
plug.function(:PlugAdd, :args => 2, :sync => true) do |nvim, x, y|
|
7
|
-
x + y
|
8
|
-
end
|
9
|
-
|
10
|
-
plug.autocmd(:BufEnter, :pattern => "*.rb") do |nvim|
|
11
|
-
nvim.command("let g:PlugInRuby = 1")
|
12
|
-
end
|
13
|
-
end
|
data/spec/documentation_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require "json"
|
2
|
-
require "net/http"
|
3
|
-
require "open-uri"
|
4
|
-
|
5
|
-
RSpec.describe "neovim-ruby documentation" do
|
6
|
-
it "has up-to-date generated method docs" do
|
7
|
-
begin
|
8
|
-
url = "https://api.github.com/repos/neovim/neovim/releases/latest"
|
9
|
-
response = open(url) { |json| JSON.load(json) }
|
10
|
-
|
11
|
-
client_file = File.read(
|
12
|
-
File.expand_path("../../lib/neovim/client.rb", __FILE__)
|
13
|
-
)
|
14
|
-
docs_version = client_file[
|
15
|
-
/The methods documented here were generated using (.+)$/,
|
16
|
-
1
|
17
|
-
]
|
18
|
-
|
19
|
-
expect(docs_version).to eq(response["name"])
|
20
|
-
rescue SocketError => e
|
21
|
-
skip "Skipping: #{e}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
data/spec/neovim/window_spec.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
module Neovim
|
4
|
-
RSpec.describe Window do
|
5
|
-
let(:client) { Neovim.attach_child(Support.child_argv) }
|
6
|
-
let(:window) { client.current.window }
|
7
|
-
after { client.shutdown }
|
8
|
-
|
9
|
-
describe "if_ruby compatibility" do
|
10
|
-
describe "#buffer" do
|
11
|
-
it "returns the buffer displayed in the window" do
|
12
|
-
expect(window.buffer).to be_a(Buffer)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#height" do
|
17
|
-
it "returns the height of the window" do
|
18
|
-
client.set_option("lines", 5)
|
19
|
-
expect(window.height).to be(3)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "#height=" do
|
24
|
-
it "sets the height of the window" do
|
25
|
-
expect {
|
26
|
-
window.height = 5
|
27
|
-
}.to change { window.height }.to(5)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "#width" do
|
32
|
-
it "returns the width of the window" do
|
33
|
-
client.set_option("columns", 20)
|
34
|
-
expect(window.width).to be(20)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "#width=" do
|
39
|
-
it "sets the width of a vertically split window" do
|
40
|
-
client.command("vsplit")
|
41
|
-
|
42
|
-
expect {
|
43
|
-
window.width += 1
|
44
|
-
}.to change { window.width }.by(1)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "#cursor" do
|
49
|
-
it "returns the cursor coordinates" do
|
50
|
-
expect(window.cursor).to eq([1, 0])
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "#cursor=" do
|
55
|
-
it "uses 1-index for line numbers" do
|
56
|
-
window.buffer.lines = ["one", "two"]
|
57
|
-
client.command("normal G")
|
58
|
-
|
59
|
-
expect {
|
60
|
-
window.cursor = [1, 2]
|
61
|
-
}.to change { client.current.line }.from("two").to("one")
|
62
|
-
end
|
63
|
-
|
64
|
-
it "uses 0-index for column numbers" do
|
65
|
-
window.buffer.lines = ["one", "two"]
|
66
|
-
window.cursor = [1, 1]
|
67
|
-
|
68
|
-
expect {
|
69
|
-
client.command("normal ix")
|
70
|
-
}.to change { client.current.line }.to("oxne")
|
71
|
-
end
|
72
|
-
|
73
|
-
it "supports out of range indexes" do
|
74
|
-
window.buffer.lines = ["x", "xx"]
|
75
|
-
|
76
|
-
expect {
|
77
|
-
window.cursor = [10, 10]
|
78
|
-
}.to change { window.cursor }.to([2, 1])
|
79
|
-
|
80
|
-
expect {
|
81
|
-
window.cursor = [0, -1]
|
82
|
-
}.to change { window.cursor }.to([1, 0])
|
83
|
-
end
|
84
|
-
|
85
|
-
it "returns the cursor array" do
|
86
|
-
expect(window.cursor = [10, 10]).to eq([10, 10])
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|