From 3d98eefc6590b8b008667b14f3534611e7fd0d44 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Tue, 21 Nov 2023 16:06:29 -0500 Subject: [PATCH] Update some constants --- src/common/document.ts | 4 ++-- src/common/editor.ts | 4 ++-- src/common/mod.ts | 5 +++-- src/common/row.ts | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/common/document.ts b/src/common/document.ts index 4710260..61b6588 100644 --- a/src/common/document.ts +++ b/src/common/document.ts @@ -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 { diff --git a/src/common/editor.ts b/src/common/editor.ts index 157a28d..428a0e4 100644 --- a/src/common/editor.ts +++ b/src/common/editor.ts @@ -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; diff --git a/src/common/mod.ts b/src/common/mod.ts index 648d6cb..47e5017 100644 --- a/src/common/mod.ts +++ b/src/common/mod.ts @@ -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; diff --git a/src/common/row.ts b/src/common/row.ts index 3ac252d..5b825d5 100644 --- a/src/common/row.ts +++ b/src/common/row.ts @@ -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++; }