File tree Expand file tree Collapse file tree 2 files changed +24
-19
lines changed
Expand file tree Collapse file tree 2 files changed +24
-19
lines changed Original file line number Diff line number Diff line change 1313- ** Debug rendering in headless mode:**
1414 ` nvim --headless -u tests/manual/init_replay.lua "+ReplayHeadless" "+ReplayLoad tests/data/FILE.json" "+ReplayAll 1" "+sleep 500m | qa!" `
1515 This will replay events and dump the output buffer to stdout, useful for debugging rendering issues without a UI.
16+ You can run to just a specific message # with (e.g. message # 12):
17+ ` nvim --headless -u tests/manual/init_replay.lua "+ReplayHeadless" "+ReplayLoad tests/data/message-removal.json" "+ReplayNext 12" "+sleep 500m | qa" `
18+ ```
19+
20+ ```
1621- ** Lint:** No explicit lint command; follow Lua best practices.
1722
1823## Code Style Guidelines
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ function M.emit_event(event)
7878end
7979
8080function M .replay_next (steps )
81- steps = steps or 1
81+ steps = tonumber ( steps ) or 1
8282
8383 if M .current_index >= # M .events then
8484 vim .notify (' No more events to replay' , vim .log .levels .WARN )
@@ -94,6 +94,10 @@ function M.replay_next(steps)
9494 return
9595 end
9696 end
97+
98+ if M .headless_mode and steps > 1 then
99+ M .dump_buffer_and_quit ()
100+ end
97101end
98102
99103function M .replay_all (delay_ms )
@@ -120,26 +124,22 @@ function M.replay_all(delay_ms)
120124
121125 M .timer = vim .loop .new_timer ()
122126 --- @diagnostic disable-next-line : undefined-field
123- M .timer :start (
124- 0 ,
125- delay_ms ,
126- vim .schedule_wrap (function ()
127- if M .current_index >= # M .events then
128- if M .timer then
129- --- @diagnostic disable-next-line : undefined-field
130- M .timer :stop ()
131- M .timer = nil
132- end
133- state .job_count = 0
134- if M .headless_mode then
135- M .dump_buffer_and_quit ()
136- end
137- return
127+ M .timer :start (0 , delay_ms , function ()
128+ if M .current_index >= # M .events then
129+ if M .timer then
130+ --- @diagnostic disable-next-line : undefined-field
131+ M .timer :stop ()
132+ M .timer = nil
133+ end
134+ state .job_count = 0
135+ if M .headless_mode then
136+ M .dump_buffer_and_quit ()
138137 end
138+ return
139+ end
139140
140- M .replay_next ()
141- end )
142- )
141+ M .replay_next ()
142+ end )
143143end
144144
145145function M .replay_stop ()
You can’t perform that action at this time.
0 commit comments