add newline intent mod in text area

This commit is contained in:
Ajay Bura 2024-12-21 20:01:45 +05:30
parent 81738d4f5d
commit 64a5bf500f

View file

@ -71,7 +71,7 @@ export class Intent {
return new Cursor(start, end, cursor.direction);
}
public addNextLine(cursor: Cursor): Cursor {
public addNewLine(cursor: Cursor): Cursor {
const lineIntent = this.lineIntent(cursor);
const line = `\n${lineIntent}`;
@ -79,6 +79,16 @@ export class Intent {
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 {
const lineIntent = this.lineIntent(cursor);
const line = `\n${lineIntent}`;