Update some constants
This commit is contained in:
parent
95c979066a
commit
3d98eefc65
@ -1,7 +1,7 @@
|
|||||||
import { chars } from './utils.ts';
|
import { chars } from './utils.ts';
|
||||||
import Row from './row.ts';
|
import Row from './row.ts';
|
||||||
import { getRuntime } from './runtime.ts';
|
import { getRuntime } from './runtime.ts';
|
||||||
import { Position, TAB_SIZE } from './mod.ts';
|
import { Position, SCROLL_TAB_SIZE } from './mod.ts';
|
||||||
|
|
||||||
export class Document {
|
export class Document {
|
||||||
#filename: string | null;
|
#filename: string | null;
|
||||||
@ -80,7 +80,7 @@ export class Document {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateRow(r: Row): void {
|
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 {
|
private rowsToString(): string {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Ansi, { KeyCommand } from './ansi.ts';
|
import Ansi, { KeyCommand } from './ansi.ts';
|
||||||
import Buffer from './buffer.ts';
|
import Buffer from './buffer.ts';
|
||||||
import Document from './document.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 Row from './row.ts';
|
||||||
import { ctrlKey, maxAdd, posSub, truncate } from './utils.ts';
|
import { ctrlKey, maxAdd, posSub, truncate } from './utils.ts';
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ class Editor {
|
|||||||
|
|
||||||
private drawPlaceholderRow(y: number): void {
|
private drawPlaceholderRow(y: number): void {
|
||||||
if (y === Math.trunc(this.#screen.rows / 2) && this.#document.isEmpty()) {
|
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)
|
const messageLen = (message.length > this.#screen.cols)
|
||||||
? this.#screen.cols
|
? this.#screen.cols
|
||||||
: message.length;
|
: message.length;
|
||||||
|
@ -6,5 +6,6 @@ export * from './utils.ts';
|
|||||||
|
|
||||||
export type * from './types.ts';
|
export type * from './types.ts';
|
||||||
|
|
||||||
export const VERSION = '0.0.1';
|
export const SCROLL_VERSION = '0.0.1';
|
||||||
export const TAB_SIZE = 4;
|
export const SCROLL_QUIT_TIMES = 3;
|
||||||
|
export const SCROLL_TAB_SIZE = 4;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { TAB_SIZE } from './mod.ts';
|
import { SCROLL_TAB_SIZE } from './mod.ts';
|
||||||
import * as Util from './utils.ts';
|
import * as Util from './utils.ts';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,7 +49,7 @@ export class Row {
|
|||||||
let j = 0;
|
let j = 0;
|
||||||
for (; j < cx; j++) {
|
for (; j < cx; j++) {
|
||||||
if (this.chars[j] === '\t') {
|
if (this.chars[j] === '\t') {
|
||||||
rx += (TAB_SIZE - 1) - (rx % TAB_SIZE);
|
rx += (SCROLL_TAB_SIZE - 1) - (rx % SCROLL_TAB_SIZE);
|
||||||
}
|
}
|
||||||
rx++;
|
rx++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user