mirror of
https://github.com/rabirabirara/obsidian-jelly-snippets.git
synced 2026-07-22 07:30:22 +00:00
fix: delete only eol with autotrig enter nows
This commit is contained in:
parent
8cf68cfc87
commit
b10ec1ade3
1 changed files with 14 additions and 2 deletions
16
main.ts
16
main.ts
|
|
@ -231,14 +231,26 @@ export default class JellySnippets extends Plugin {
|
|||
if (snippetType === SnippetType.MLSR) {
|
||||
// RCNN - do nothing
|
||||
} else {
|
||||
// RCNDMU - delete from curpos to start of next line
|
||||
// RCNDMU - delete newline at the end of this line
|
||||
let curpos = editor.getCursor();
|
||||
// Get current line and find its end
|
||||
// (Can also calculate it, but requires you to get the entire line string)
|
||||
let curLineEndPos: EditorPosition = {
|
||||
line: curpos.line,
|
||||
ch: editor.getLine(curpos.line).length,
|
||||
};
|
||||
// Get next line's beginning
|
||||
let nextLine = curpos.line + 1;
|
||||
let nextLineStartPos: EditorPosition = {
|
||||
line: nextLine,
|
||||
ch: 0,
|
||||
};
|
||||
editor.replaceRange("", curpos, nextLineStartPos);
|
||||
// Delete from end of current line to beginning of next line (erasing newline)
|
||||
editor.replaceRange(
|
||||
"",
|
||||
curLineEndPos,
|
||||
nextLineStartPos
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// YesWS
|
||||
|
|
|
|||
Loading…
Reference in a new issue