fix: nui input cannot paste (#187)
This commit is contained in:
parent
dbf2509d44
commit
b8b5a3086e
@ -1385,9 +1385,11 @@ function Sidebar:create_input()
|
||||
width = win_width - 2, -- Subtract the width of the input box borders
|
||||
},
|
||||
}, {
|
||||
disable_cursor_position_patch = true,
|
||||
prompt = Config.windows.prompt.prefix,
|
||||
default_value = "",
|
||||
default_value = " ",
|
||||
on_submit = function(user_input)
|
||||
user_input = Utils.trim_spaces(user_input)
|
||||
if user_input == "" then
|
||||
self:create_input()
|
||||
return
|
||||
|
@ -30,11 +30,14 @@ function M.trim(str, opts)
|
||||
if not opts then
|
||||
return str
|
||||
end
|
||||
local res = str
|
||||
if opts.suffix then
|
||||
return str:sub(-1) == opts.suffix and str:sub(1, -2) or str
|
||||
elseif opts.prefix then
|
||||
return str:sub(1, 1) == opts.prefix and str:sub(2) or str
|
||||
res = str:sub(#str - #opts.suffix + 1) == opts.suffix and str:sub(1, #str - #opts.suffix) or str
|
||||
end
|
||||
if opts.prefix then
|
||||
res = str:sub(1, #opts.prefix) == opts.prefix and str:sub(#opts.prefix + 1) or str
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
function M.in_visual_mode()
|
||||
@ -316,4 +319,8 @@ function M.is_sidebar_buffer(bufnr)
|
||||
return v == true
|
||||
end
|
||||
|
||||
function M.trim_spaces(s)
|
||||
return s:match("^%s*(.-)%s*$")
|
||||
end
|
||||
|
||||
return M
|
||||
|
Loading…
x
Reference in New Issue
Block a user