File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1+ local setup = require (" dap-view.setup" )
12local util = require (" dap-view.util" )
23local state = require (" dap-view.state" )
34
@@ -22,17 +23,21 @@ M.scroll = function(bufnr)
2223 end ,
2324 })
2425
26+ local winnr = vim .tbl_contains (setup .config .winbar .sections , " console" ) and state .winnr or state .term_winnr
27+
2528 api .nvim_buf_attach (bufnr , false , {
2629 on_lines = function ()
27- if not util .is_win_valid (state . term_winnr ) then
30+ if not util .is_win_valid (winnr ) then
2831 return
2932 end
33+ --- @cast winnr integer
3034 if autoscroll and vim .fn .mode () == " n" then
31- api .nvim_win_call (state . term_winnr , function ()
35+ api .nvim_win_call (winnr , function ()
3236 if api .nvim_get_current_buf () == bufnr then
33- -- vim.schedule ensures the cursor movement happens in the main event loop.
37+ -- vim.schedule ensures the cursor movement happens in the main event loop
38+ -- otherwise the call may happen too early
3439 vim .schedule (function ()
35- api .nvim_win_set_cursor (state . term_winnr , { api .nvim_buf_line_count (bufnr ), 0 })
40+ api .nvim_win_set_cursor (winnr , { api .nvim_buf_line_count (bufnr ), 0 })
3641 end )
3742 end
3843 end )
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ local api = vim.api
88M .track_cursor_position = function (current_frame_id )
99 for k , v in pairs (state .frames_by_line ) do
1010 if v .id == current_frame_id then
11- api .nvim_win_set_cursor (state .winnr , { k , 1 })
11+ api .nvim_win_set_cursor (state .winnr , { k , 0 })
1212 end
1313 end
1414end
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ M.switch_to_view = function(view)
5454 local buf_len = api .nvim_buf_line_count (state .bufnr )
5555 state .cur_pos [view ] = math.min (cursor_line , buf_len )
5656
57- api .nvim_win_set_cursor (state .winnr , { state .cur_pos [view ], 1 })
57+ api .nvim_win_set_cursor (state .winnr , { state .cur_pos [view ], 0 })
5858end
5959
6060return M
You can’t perform that action at this time.
0 commit comments