local table = require 'std.table' local M = {} function M.new(content, pos, firstc, prompt, indent, level) vim.validate({ content = { content, 'table' }, pos = { pos, 'number' }, firstc = { firstc, 'string' }, prompt = { prompt, 'string' }, indent = { indent, 'number' }, level = { level, 'number' }, }) return setmetatable({ content = content, pos = pos, firstc = firstc, prompt = prompt, indent = indent, level = level, }, { __index = M }) end function M:text() local parts = {} for _, chunk in ipairs(self.content) do table.insert(parts, chunk[2]) end return table.concat(parts) end function M:cursor_byte() return self.pos end function M:is_search() return self.firstc == '/' or self.firstc == '?' end function M:is_input() return self.prompt ~= nil and self.prompt ~= '' end return M