mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
fix: correct appendBoundedText slice offset when keep is zero
This commit is contained in:
@@ -183,8 +183,8 @@ function appendBoundedText(current: string, next: string): string {
|
|||||||
if (!next) return current;
|
if (!next) return current;
|
||||||
// Avoid allocating `current + next` when already at/above limit — slide the window instead.
|
// Avoid allocating `current + next` when already at/above limit — slide the window instead.
|
||||||
if (current.length >= STREAM_SUMMARY_TEXT_LIMIT) {
|
if (current.length >= STREAM_SUMMARY_TEXT_LIMIT) {
|
||||||
const keep =
|
const keep = STREAM_SUMMARY_TEXT_LIMIT - next.length;
|
||||||
STREAM_SUMMARY_TEXT_LIMIT > next.length ? STREAM_SUMMARY_TEXT_LIMIT - next.length : 0;
|
if (keep <= 0) return next.slice(-STREAM_SUMMARY_TEXT_LIMIT);
|
||||||
return current.slice(-keep) + next;
|
return current.slice(-keep) + next;
|
||||||
}
|
}
|
||||||
const combined = current + next;
|
const combined = current + next;
|
||||||
|
|||||||
Reference in New Issue
Block a user