Merge pull request #5145 from mempool/natsoni/tapscript-toggle-show-more

Refactor "show all" toggle for long witnesses and witness scripts
This commit is contained in:
softsimon
2024-06-10 00:11:26 +04:00
committed by GitHub
4 changed files with 62 additions and 52 deletions

View File

@@ -5,13 +5,18 @@ import { Pipe, PipeTransform } from '@angular/core';
})
export class AsmStylerPipe implements PipeTransform {
transform(asm: string): string {
transform(asm: string, showAll = true): string {
const instructions = asm.split('OP_');
let out = '';
let chars = -3;
for (const instruction of instructions) {
if (instruction === '') {
continue;
}
if (!showAll && chars > 1000) {
break;
}
chars += instruction.length + 3;
out += this.addStyling(instruction);
}
return out;