@@ -69,6 +69,10 @@ function M.get_buf_line_count()
6969 return vim .api .nvim_buf_line_count (state .windows .output_buf )
7070end
7171
72+ --- FIXME: remove debugging code
73+ M ._lines_set = 0
74+ M ._set_calls = 0
75+
7276--- Set the output buffer contents
7377--- @param lines string[] The lines to set
7478--- @param start_line ? integer The starting line to set , defaults to 0
@@ -86,14 +90,45 @@ function M.set_lines(lines, start_line, end_line)
8690 return
8791 end
8892
93+ --- FIXME: remove debugging code
94+ if vim .tbl_isempty (lines ) then
95+ M ._lines_set = 0
96+ M ._set_calls = 0
97+ else
98+ M ._lines_set = M ._lines_set + # lines
99+ M ._set_calls = M ._set_calls + 1
100+ end
101+
89102 vim .api .nvim_set_option_value (' modifiable' , true , { buf = windows .output_buf })
103+ -- vim.notify(vim.inspect(lines))
90104 vim .api .nvim_buf_set_lines (windows .output_buf , start_line , end_line , false , lines )
91105 vim .api .nvim_set_option_value (' modifiable' , false , { buf = windows .output_buf })
92106end
93107
108+ --- FIXME: remove debugging code
109+ --- Set text in a specific line at character positions
110+ --- @param line integer The line number (0-indexed )
111+ --- @param start_col integer The starting column (0-indexed )
112+ --- @param end_col integer The ending column (0-indexed )
113+ --- @param text string The text to insert
114+ function M .set_text (line , start_col , end_col , text )
115+ if not M .mounted () then
116+ return
117+ end
118+
119+ local windows = state .windows
120+ if not windows or not windows .output_buf then
121+ return
122+ end
123+
124+ vim .api .nvim_set_option_value (' modifiable' , true , { buf = windows .output_buf })
125+ vim .api .nvim_buf_set_text (windows .output_buf , line , start_col , line , end_col , { text })
126+ vim .api .nvim_set_option_value (' modifiable' , false , { buf = windows .output_buf })
127+ end
128+
94129--- Clear output buf extmarks
95130--- @param start_line ? integer Line to start clearing , defaults 0
96- --- @param end_line ? integer Line to to clear until , defaults to -1
131+ --- @param end_line ? integer Line to clear until , defaults to -1
97132function M .clear_extmarks (start_line , end_line )
98133 if not M .mounted () or not state .windows .output_buf then
99134 return
0 commit comments