How to use the ansi-escapes.clearTerminal function in ansi-escapes

To help you get started, we’ve selected a few ansi-escapes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EvanBacon / react-native-ink / src / modules / Instance / index.tsx View on Github external
if (isCI) {
      if (hasStaticOutput) {
        this.options.stdout.write(staticOutput);
      }

      this.lastOutput = output;
      return;
    }

    if (hasStaticOutput) {
      this.fullStaticOutput += staticOutput;
    }

    if (this.options.experimental && outputHeight >= this.options.stdout.rows) {
      this.options.stdout.write(
        ansiEscapes.clearTerminal + this.fullStaticOutput + output,
      );
      this.lastOutput = output;
      return;
    }

    // To ensure static output is cleanly rendered before main output, clear main output first
    if (hasStaticOutput) {
      this.log.clear();
      this.options.stdout.write(staticOutput);
    }

    if (output !== this.lastOutput) {
      if (this.options.experimental) {
        this.throttledLog(output);
      } else {
        this.log(output);
github vadimdemedes / ink / src / instance.js View on Github external
if (isCI) {
			if (hasStaticOutput) {
				this.options.stdout.write(staticOutput);
			}

			this.lastOutput = output;
			return;
		}

		if (hasStaticOutput) {
			this.fullStaticOutput += staticOutput;
		}

		if (this.options.experimental && outputHeight >= this.options.stdout.rows) {
			this.options.stdout.write(ansiEscapes.clearTerminal + this.fullStaticOutput + output);
			this.lastOutput = output;
			return;
		}

		// To ensure static output is cleanly rendered before main output, clear main output first
		if (hasStaticOutput) {
			this.log.clear();
			this.options.stdout.write(staticOutput);
		}

		if (output !== this.lastOutput) {
			if (this.options.experimental) {
				this.throttledLog(output);
			} else {
				this.log(output);
			}
github obiwankenoobi / TinyScratchpad.js / app / components / Editor.js View on Github external
this.setTimer(async () => {
            xtermInstance.instance.write(ansiEscapes.clearTerminal);

            if (pathRegEX.test(firstLine)) {
               
                const trimmedLine = firstLine.slice(2, -2).trim();
                const prefix = trimmedLine[0] === "/" ? "" : "";
                ptyInstance.instance.write(`${prefix} ${trimmedLine} ${this.tmpobj.name}\n`);
            } else {
                exec('which node', (error, stdout, stderr) => {
                    if (error) alert(`exec error: ${error}`); 
                    else ptyInstance.instance.write(`${stdout.slice(0, stdout.length - 1)} ${this.tmpobj.name}\n`);
                });
            }
        })
github salifm / cli-games / MazeEscape / index.js View on Github external
function print(str, hide=true) {
    console.log(esc.clearTerminal)
    console.log(str);
    console.log(hide ? esc.cursorHide : esc.cursorShow);
}
github bet4it / hyperpwn / index.js View on Github external
replayUid(uid, cols) {
    if (uid in this.records && Number.isInteger(this.index)) {
      let data = this.records[uid][this.index]
      data = data.replace(/^.*$/mg, line => cliTruncate(expandTabs(line), cols))
      data = ansiEscapes.clearTerminal + data
      this.store.dispatch({
        type: 'SESSION_PTY_DATA',
        uid,
        data
      })
    }
  }
github voidcosmos / npkill / src / controller.ts View on Github external
private clear(): void {
    this.print(ansiEscapes.clearTerminal);
  }