MCPcopy Create free account
hub / github.com/aiscript-dev/aiscript / prev

Method prev

src/parser/streams/char-stream.ts:76–89  ·  view source on GitHub ↗

* カーソル位置を前の文字へ戻します。

()

Source from the content-addressed store, hash-verified

74 * カーソル位置を前の文字へ戻します。
75 */
76 public prev(): void {
77 this.movePrev();
78 this.decAddr();
79 if (!this.startOfFile && this._char === '\n') {
80 this.line--;
81 const page = this.pages.get(this.pageIndex)!;
82 const lastLineBreak = page.lastIndexOf('\n', this.address - 1);
83 const lineStart = lastLineBreak >= 0 ? lastLineBreak + 1 : 0;
84 const line = page.slice(lineStart, this.address);
85 this.column = line.length;
86 } else {
87 this.column -= this._char!.length;
88 }
89 }
90
91 private get isFirstPage(): boolean {
92 return (this.pageIndex <= this.firstPageIndex);

Callers 3

parser.tsFile · 0.80
readTokenMethod · 0.80
skipEmptyLinesMethod · 0.80

Calls 3

movePrevMethod · 0.95
decAddrMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected