mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-03-27 21:31:49 +01:00
add newline intent mod in text area
This commit is contained in:
parent
81738d4f5d
commit
64a5bf500f
1 changed files with 11 additions and 1 deletions
|
@ -71,7 +71,7 @@ export class Intent {
|
||||||
return new Cursor(start, end, cursor.direction);
|
return new Cursor(start, end, cursor.direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public addNextLine(cursor: Cursor): Cursor {
|
public addNewLine(cursor: Cursor): Cursor {
|
||||||
const lineIntent = this.lineIntent(cursor);
|
const lineIntent = this.lineIntent(cursor);
|
||||||
const line = `\n${lineIntent}`;
|
const line = `\n${lineIntent}`;
|
||||||
|
|
||||||
|
@ -79,6 +79,16 @@ export class Intent {
|
||||||
return new Cursor(insertCursor.end, insertCursor.end, 'none');
|
return new Cursor(insertCursor.end, insertCursor.end, 'none');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addNextLine(cursor: Cursor): Cursor {
|
||||||
|
const lineIntent = this.lineIntent(cursor);
|
||||||
|
const line = `\n${lineIntent}`;
|
||||||
|
|
||||||
|
const currentLine = this.textArea.cursorLines(cursor);
|
||||||
|
const lineCursor = new Cursor(currentLine.end, currentLine.end, 'none');
|
||||||
|
const insertCursor = this.operations.insert(lineCursor, line);
|
||||||
|
return new Cursor(insertCursor.end, insertCursor.end, 'none');
|
||||||
|
}
|
||||||
|
|
||||||
public addPreviousLine(cursor: Cursor): Cursor {
|
public addPreviousLine(cursor: Cursor): Cursor {
|
||||||
const lineIntent = this.lineIntent(cursor);
|
const lineIntent = this.lineIntent(cursor);
|
||||||
const line = `\n${lineIntent}`;
|
const line = `\n${lineIntent}`;
|
||||||
|
|
Loading…
Reference in a new issue