Skip to content

Commit

Permalink
Fix jump to frame regression in REPL and frames widget
Browse files Browse the repository at this point in the history
After 16c2274 `<CR>` on frames no
longer jumped to the frame but instead resulted in a message that there
is no action on the frame.
  • Loading branch information
mfussenegger committed Dec 7, 2021
1 parent ce4e56f commit b264bb2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/dap/repl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ local function new_buf()
if ok then
api.nvim_buf_set_option(buf, 'path', path)
end
api.nvim_buf_set_keymap(buf, 'n', '<CR>', "<Cmd>lua require('dap.ui').trigger_actions({ filter = 'Expand' })<CR>", {})
api.nvim_buf_set_keymap(buf, 'n', '<CR>', "<Cmd>lua require('dap.ui').trigger_actions({ mode = 'first' })<CR>", {})
api.nvim_buf_set_keymap(buf, 'i', '<up>', "<Cmd>lua require('dap.repl').on_up()<CR>", {})
api.nvim_buf_set_keymap(buf, 'i', '<down>', "<Cmd>lua require('dap.repl').on_down()<CR>", {})
vim.fn.prompt_setprompt(buf, 'dap> ')
Expand Down
5 changes: 5 additions & 0 deletions lua/dap/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ function M.trigger_actions(opts)
utils.notify('No action possible on: ' .. api.nvim_buf_get_lines(buf, lnum, lnum + 1, true)[1], vim.log.levels.INFO)
return
end
if opts.mode == 'first' then
local action = actions[1]
action.fn(layer, info.item, lnum, info.context)
return
end
M.pick_if_many(
actions,
'Actions> ',
Expand Down
2 changes: 1 addition & 1 deletion lua/dap/ui/widgets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local function new_buf()
api.nvim_buf_set_option(buf, 'buftype', 'nofile')
api.nvim_buf_set_option(buf, 'modifiable', false)
api.nvim_buf_set_keymap(
buf, "n", "<CR>", "<Cmd>lua require('dap.ui').trigger_actions({ filter = 'Expand' })<CR>", {})
buf, "n", "<CR>", "<Cmd>lua require('dap.ui').trigger_actions({ mode = 'first' })<CR>", {})
api.nvim_buf_set_keymap(
buf, "n", "a", "<Cmd>lua require('dap.ui').trigger_actions()<CR>", {})
api.nvim_buf_set_keymap(
Expand Down

0 comments on commit b264bb2

Please sign in to comment.