@@ -244,6 +244,13 @@ function M.RegQAUI:get_special()
244
244
-- Get all lines
245
245
local lines = vim .api .nvim_buf_get_lines (buf , math.max (cursor_pos [1 ] - content_max_len - 1 , 0 ),
246
246
math.min (cursor_pos [1 ] + content_max_len , line_count ), false )
247
+ -- prepend/append annotation if lines are omitted (like <.... X lines omitted .....>)
248
+ if cursor_pos [1 ] - content_max_len - 1 > 0 then
249
+ table.insert (lines , 1 , string.format (" <.... %d lines omitted .....>" , cursor_pos [1 ] - content_max_len - 1 ))
250
+ end
251
+ if cursor_pos [1 ] + content_max_len < line_count then
252
+ table.insert (lines , string.format (" <.... %d lines omitted .....>" , line_count - (cursor_pos [1 ] + content_max_len )))
253
+ end
247
254
res [" content" ] = table.concat (lines , " \n " )
248
255
res [" full_content" ] = table.concat (vim .api .nvim_buf_get_lines (buf , 0 , - 1 , false ), " \n " )
249
256
@@ -277,6 +284,13 @@ function M.RegQAUI:get_special()
277
284
-- Get the context lines
278
285
local context_lines = vim .api .nvim_buf_get_lines (buf , start_line , end_line , false )
279
286
-- Now 'context_lines' is a table containing all context lines
287
+ -- prepend/append annotation if lines are omitted (like <.... X lines omitted .....>)
288
+ if start_line > 0 then
289
+ table.insert (context_lines , 1 , string.format (" <.... %d lines omitted .....>" , start_line ))
290
+ end
291
+ if end_line < line_count then
292
+ table.insert (context_lines , string.format (" <.... %d lines omitted .....>" , line_count - end_line ))
293
+ end
280
294
res [" context" ] = table.concat (context_lines , " \n " )
281
295
282
296
-- 5) Get content in all buffers that have corresponding files on disk; use get_buf_cont
0 commit comments