INNER CODE UNIT · Python

Lines

pystardust/ytfzf · addons/interfaces/sixel-menu/menu.py:73

class Lines(list):
    renderCmd = ""

    def __init__(self, *data):
        super().__init__(data)
        self.selectedLine = 0
        self.outputCache = {}

    def renderPreview(self, line):
        sys.stderr.write("\033[s")
        sys.stderr.write(f'\033[0;{TERMCOLUMNS // 2 + 1}H')
        if self.outputCache.get(self.selectedLine):
            sys.stderr.write(self.outputCache[self.selectedLine])
        else:
            cmd = list(map(lambda x: x.replace(
                "{}", line), self.renderCmd))
            o = subprocess.check_output(cmd).decode("utf-8")
            self.outputCache[self.selectedLine] = o

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…