Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lua/dap/repl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ local M = {}
local history = {
last = nil,
entries = {},
idx = 1
idx = 1,
max_size = 5000,
}

local autoscroll = vim.fn.has('nvim-0.7') == 1
Expand Down Expand Up @@ -226,6 +227,9 @@ function execute(text)
end
else
history.last = text
if #history.entries == history.max_size then
table.remove(history.entries, 1)
end
table.insert(history.entries, text)
history.idx = #history.entries + 1
end
Expand All @@ -245,8 +249,7 @@ function execute(text)
return
elseif vim.tbl_contains(M.commands.clear, text) then
if repl.buf and api.nvim_buf_is_loaded(repl.buf) then
local layer = ui.layer(repl.buf)
layer.render({}, tostring, {}, 0, - 1)
M.clear()
end
return
end
Expand Down Expand Up @@ -384,9 +387,6 @@ end


function M.clear()
history.last = nil
history.entries = {}
history.idx = 1
if repl.buf and api.nvim_buf_is_loaded(repl.buf) then
local layer = ui.layer(repl.buf)
layer.render({}, tostring, {}, 0, - 1)
Expand Down