File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ local config = require("neogit.config")
33local status_maps = require (" neogit.config" ).get_reversed_status_maps ()
44
55--- @class ProcessBuffer
6+ --- @field lines integer
7+ --- @field truncated boolean
68--- @field buffer Buffer
79--- @field open fun ( self )
810--- @field hide fun ( self )
@@ -24,6 +26,8 @@ function M:new(process)
2426 content = string.format (" > %s\r\n " , table.concat (process .cmd , " " )),
2527 process = process ,
2628 buffer = nil ,
29+ lines = 0 ,
30+ truncated = false ,
2731 }
2832
2933 setmetatable (instance , self )
@@ -67,6 +71,20 @@ function M:refresh()
6771end
6872
6973function M :append (data )
74+ self .lines = self .lines + 1
75+ if self .lines > 300 then
76+ if not self .truncated then
77+ self .content = table.concat ({ self .content , " \r\n [Output too long - Truncated]" }, " \r\n " )
78+ self .truncated = true
79+
80+ if self :is_visible () then
81+ self :refresh ()
82+ end
83+ end
84+
85+ return
86+ end
87+
7088 self .content = table.concat ({ self .content , data }, " \r\n " )
7189
7290 if self :is_visible () then
Original file line number Diff line number Diff line change @@ -249,15 +249,13 @@ function Process:spawn(cb)
249249
250250 local stdout_on_line = function (line )
251251 insert (res .stdout , line )
252- insert (res .output , line )
253252 self .buffer :append (line )
254253 end
255254
256255 local stderr_on_partial = function () end
257256
258257 local stderr_on_line = function (line )
259258 insert (res .stderr , line )
260- insert (res .output , line )
261259 self .buffer :append (line )
262260 end
263261
You can’t perform that action at this time.
0 commit comments