Update some constants

This commit is contained in:
Timothy Warren 2023-11-21 16:06:29 -05:00
parent 95c979066a
commit 3d98eefc65
4 changed files with 9 additions and 8 deletions

View File

@ -1,7 +1,7 @@
import { chars } from './utils.ts';
import Row from './row.ts';
import { getRuntime } from './runtime.ts';
import { Position, TAB_SIZE } from './mod.ts';
import { Position, SCROLL_TAB_SIZE } from './mod.ts';
export class Document {
#filename: string | null;
@ -80,7 +80,7 @@ export class Document {
}
private updateRow(r: Row): void {
r.render = chars(r.toString().replace('\t', ' '.repeat(TAB_SIZE)));
r.render = chars(r.toString().replace('\t', ' '.repeat(SCROLL_TAB_SIZE)));
}
private rowsToString(): string {

View File

@ -1,7 +1,7 @@
import Ansi, { KeyCommand } from './ansi.ts';
import Buffer from './buffer.ts';
import Document from './document.ts';
import { ITerminalSize, logToFile, Position, VERSION } from './mod.ts';
import { ITerminalSize, logToFile, Position, SCROLL_VERSION } from './mod.ts';
import Row from './row.ts';
import { ctrlKey, maxAdd, posSub, truncate } from './utils.ts';
@ -292,7 +292,7 @@ class Editor {
private drawPlaceholderRow(y: number): void {
if (y === Math.trunc(this.#screen.rows / 2) && this.#document.isEmpty()) {
const message = `Kilo editor -- version ${VERSION}`;
const message = `Scroll editor -- version ${SCROLL_VERSION}`;
const messageLen = (message.length > this.#screen.cols)
? this.#screen.cols
: message.length;

View File

@ -6,5 +6,6 @@ export * from './utils.ts';
export type * from './types.ts';
export const VERSION = '0.0.1';
export const TAB_SIZE = 4;
export const SCROLL_VERSION = '0.0.1';
export const SCROLL_QUIT_TIMES = 3;
export const SCROLL_TAB_SIZE = 4;

View File

@ -1,4 +1,4 @@
import { TAB_SIZE } from './mod.ts';
import { SCROLL_TAB_SIZE } from './mod.ts';
import * as Util from './utils.ts';
/**
@ -49,7 +49,7 @@ export class Row {
let j = 0;
for (; j < cx; j++) {
if (this.chars[j] === '\t') {
rx += (TAB_SIZE - 1) - (rx % TAB_SIZE);
rx += (SCROLL_TAB_SIZE - 1) - (rx % SCROLL_TAB_SIZE);
}
rx++;
}