Skip to content

Commit

Permalink
fix: bufconfig return code is not ignored when sending data.
Browse files Browse the repository at this point in the history
  • Loading branch information
Klafyvel committed Feb 28, 2024
1 parent 5d7a5e6 commit 80ec83d
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lua/smuggler/reslime.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ local M = {}
local protocol = require "smuggler.protocol"

function M.send(code, firstline, filename)
protocol.bufconfig()
local r = protocol.bufconfig()
if r == -1 then
return -1
end
protocol.send(code, firstline, filename)
end

-- This is intended to be used as an operator. See `:help :map-operator`.
function M.send_op(type)
protocol.bufconfig()
local r = protocol.bufconfig()
if r == -1 then
return -1
end

local row_start = 1
local text = ""
Expand All @@ -38,7 +44,10 @@ function M.send_op(type)
end

function M.send_range(linestart, linestop)
protocol.bufconfig()
local r = protocol.bufconfig()
if r == -1 then
return -1
end
local text = table.concat(
vim.api.nvim_buf_get_lines(0, linestart - 1, linestop, false),
"\n"
Expand All @@ -47,7 +56,10 @@ function M.send_range(linestart, linestop)
end

function M.send_lines(count)
protocol.bufconfig()
local r = protocol.bufconfig()
if r == -1 then
return -1
end
if count < 1 then
count = 1
end
Expand Down

0 comments on commit 80ec83d

Please sign in to comment.