Skip to content

Commit

Permalink
fix: canvas draw() performance/crashing issues under some circumstances
Browse files Browse the repository at this point in the history
  • Loading branch information
Im-Beast committed Nov 4, 2022
1 parent 760347e commit f6fa684
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export class Canvas extends EventEmitter<CanvasEventMap> {
return;
}

const noResetStyle = value.match(/((.|\s)+?)\x1b\[0m/)?.[1] ?? "";
const resetStyleIndex = value.indexOf("\x1b[0m");
const noResetStyle = resetStyleIndex === -1 ? "" : value.substring(0, resetStyleIndex);
const borderIndex = noResetStyle.lastIndexOf("m", noResetStyle.length - stripped.length);

const distinctStyles = (
Expand Down

0 comments on commit f6fa684

Please sign in to comment.