mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-03 12:34:42 +00:00
* fix(terminal): trim the replay buffer when output has no newline OutputBuffer::append returned early when the last line was incomplete and the new chunk had no newline, so the trim loop never ran. A program that writes without newlines (a minified file through cat, a \r progress bar) grew the replay buffer past MAX_OUTPUT_BUFFER_SIZE without bound, one 4 KiB PTY read at a time, until a newline arrived. Signed-off-by: leoca <leo.camus23@gmail.com> * fix(terminal): keep recent output when trimming a line without newline Trimming popped the whole incomplete line once it passed MAX_OUTPUT_BUFFER_SIZE, so the reconnect replay could come back empty. Newline-free output now goes into a new chunk once the incomplete one holds DEFAULT_RECONNECT_BUFFER_BYTES, and trimming drops the oldest chunks while the newest bytes stay. The test checks get_recent. Signed-off-by: leoca <leo.camus23@gmail.com> * fix(terminal): trim an oversized incomplete line to its newest half Splitting the incomplete line into chunks made get_recent return whole chunks only, so a reconnect could replay as little as the newest read. Keep one line and, when it alone is over MAX_OUTPUT_BUFFER_SIZE, drop its oldest bytes down to half the cap. The copy then happens once per half buffer instead of on every append, and the replay keeps the newest DEFAULT_RECONNECT_BUFFER_BYTES. Signed-off-by: leoca <leo.camus23@gmail.com> --------- Signed-off-by: leoca <leo.camus23@gmail.com>