nvim-lua/plenary.nvim

plenary printing -0 instead of 0

justrajdeep opened this issue · 2 comments

Hi

Plenary is printing -0 instead of 0

local M = {}

local my_hash = {
  args = "!p4print checker.sv",
  bang = false,
  count = -1,
  fargs = { "!p4print checker.sv" },
  line1 = 2,
  line2 = 2,
  mods = "",
  name = "Redir",
  range = 0,
  reg = "",
  smods = {
    browse = false,
    confirm = false,
    emsg_silent = false,
    hide = false,
    horizontal = false,
    keepalt = false,
    keepjumps = false,
    keepmarks = false,
    keeppatterns = false,
    lockmarks = false,
    noautocmd = false,
    noswapfile = false,
    sandbox = false,
    silent = false,
    split = "",
    tab = -1,
    unsilent = false,
    verbose = -1,
    vertical = false
  }
}
local log = require('plenary.log'):new()
log.level = 'debug'

function M.Redir(opts)
  -- M.P("Redir::opts", opts)
  local cmd = opts.args
  local rng = opts.range
  local start = opts.line1
  local ending = opts.line2
  log.debug("Redit::opts", opts)
  log.debug("Redir::cmd", cmd)
  log.debug("Redir::opts.range", opts.range)
  log.debug("Redir::rng", rng)
  log.debug("Redir::start", start)
  log.debug("Redir::ending", ending)
end
M.Redir(my_hash)

|| [plenary] [DEBUG 07:46:04] function_in_buffer.lua:51: Redir::cmd !p4print checker.sv
|| [plenary] [DEBUG 07:46:04] function_in_buffer.lua:52: Redir::opts.range -0
|| [plenary] [DEBUG 07:46:04] function_in_buffer.lua:53: Redir::rng -0
|| [plenary] [DEBUG 07:46:04] function_in_buffer.lua:54: Redir::start 2
|| [plenary] [DEBUG 07:46:04] function_in_buffer.lua:55: Redir::ending 2

Vim Details

NVIM v0.10.0-dev-4459e0cee-dirty
Build type: RelWithDebInfo
LuaJIT 2.1.1710088188

I made the changes in #572, apparently it was trying to round the number 0, resulting in the number -0.

Thanks.