Class: Neovim::WriteBuf
Instance Method Summary
collapse
Methods inherited from WriteStd
redirect
Methods inherited from Write
#<<, #flush, open, #print, #puts
Constructor Details
#initialize(*args, whole: nil, top: nil) ⇒ WriteBuf
144
145
146
147
148
|
# File 'lib/neovim/output.rb', line 144
def initialize *args, whole: nil, top: nil
super
@lines, @last = [], ""
@whole, @top = whole, top
end
|
Instance Method Details
159
160
161
162
163
164
165
166
167
168
169
|
# File 'lib/neovim/output.rb', line 159
def finish
if @last.notempty? then
@lines.push @last
@last = nil
end
if @whole then
@client.buf_set_lines 0, 0, -1, true, @lines
else
@client.put @lines, "l", true, !@top
end
end
|
#write(*args) ⇒ Object
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/neovim/output.rb', line 149
def write *args
args.each { |a| @last << a.to_s }
loop do
n, r = @last.split $/, 2
r or break
@lines.push n
@last = r
end
nil
end
|