How to use the terminal-kit.terminal.moveTo function in terminal-kit

To help you get started, we’ve selected a few terminal-kit 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 brannondorsey / chattervox / src / ui / chat.ts View on Github external
export async function printReceivedMessage(message: MessageEvent, callsign: string): Promise {

    const pos: { x: number, y: number } = await term.getCursorLocation()
    if (pos) {
        term.moveTo(0, pos.y)
        term.insertLine(1)
        printStyledText(message)
        term.move(pos.x - 1, 0)

        if (term.height === pos.y) {
            if (input) {
                // term.moveTo(0, term.height)
                term.moveTo(0, term.height)
                myColorFunction(`${callsign}`)(': ')
                input.redraw()
            }
        }
    }
}
github guigrpa / oao / src / utils / parallelConsoleListener.js View on Github external
const delta = h / len;
    for (let i = 0; i < len; i++) {
      const threadId = threadIds[i];
      const thread = threads[threadId];
      thread.idx = i + 1;
      thread.y1 = Math.floor(i * delta);
      thread.y2 = Math.floor((i + 1) * delta) - 1;
      thread.shown = true;
      this.termRefreshThread(threadId, i);
    }
    for (let i = len; i < threadIds.length; i++) {
      threads[threadIds[i]].shown = false;
    }
    if (truncated) {
      const numHidden = threadIds.length - len;
      term.moveTo(1, h0, this.chalk.bgRed(`  ${numHidden} hidden thread${numHidden > 1 ? 's' : ''}`));
      // TODO: show warning that more stories are available
    }
    this.resetCursorPos();
  }
github sjurba / rebase-editor / lib / editor.js View on Github external
function resetTerminal() {
  term.saveCursor();
  term.moveTo(1, showStatus ? 2 : 1);
  lineNum = 0;
  term.eraseDisplayBelow();
  var data = input.map(cropLine).map(highlightLine).join('\n');
  data = data.replace(/(#\sCommands:[^]*?#\s*\n)/, '$1' + editorCommands.join('\n# ') + '\n#\n');
  data = data.replace(/#\sx, exec.*\s*\n/, '');
  data = data.replace(/#\sd, drop.*\s*\n/, '');
  data = data.split('\n').slice(0, term.height - 1).join('\n');
  status('Status');
  term(data);
  term.restoreCursor();
}
github sjurba / rebase-editor / lib / terminal_renderer.js View on Github external
function render(state, key, rawKey) {
  term.clear();
  term('Cursor: ' + state.cursor.pos + ' Key: ' + key + ' Raw key: ' + rawKey);
  let index = 2;
  state.lines.forEach((line) => {
    term.moveTo(1, index);
    term(line.action + ' ' + line.message);
    index++;
  });
  index++;
  state.info.forEach((line) => {
    term.moveTo(1, index);
    term(line);
    index++;
  });
  term.moveTo(1, state.cursor.pos + 2);
}
github guigrpa / oao / src / utils / parallelConsoleListener.js View on Github external
resetCursorPos() {
    term.moveTo(1, this.height);
  }
}
github alarner / config-template / index.js View on Github external
function render() {
			term.eraseDisplay();
			renderHeader();
			renderBody();
			renderFooter();
			term.moveTo(state.cursor.x, state.cursor.y);
		}
github guigrpa / storyboard / packages / storyboard-listener-console-parallel / src / index.js View on Github external
resetCursorPos() {
    if (!term.height) return;
    term.moveTo(1, this.height);
  }
}
github msaari / 18sh / modules / statusBar.js View on Github external
} else {
			barContentString += item.trim() + "    "
		}
	})
	companyBarContent += barContentString

	term.moveTo(1, playerLines + 1)
	let companyLines = Math.ceil(companyBarContent.length / term.width)
	for (let line = 1; line <= companyLines; line += 1) {
		term.bgYellow()
		term.black()
		term(new Array(term.width + 1).join(" "))
		term.nextLine()
	}

	term.moveTo(1, playerLines + 1)
	term(companyBarContent)

	term.restoreCursor()
}
github zamotany / react-slate / packages / core / src / renderFullscreen.ts View on Github external
function flushDiff(diff: RenderDiff) {
  for (let i = 0; i < diff.length; i++) {
    terminal.moveTo(1, diff[i].line + 1);
    terminal(diff[i].text);
  }
}