mirror of
https://github.com/rabirabirara/obsidian-jelly-snippets.git
synced 2026-07-22 07:30:22 +00:00
fix: start endFoundIdx at -1
This commit is contained in:
parent
b769bf70be
commit
8cf68cfc87
1 changed files with 2 additions and 3 deletions
|
|
@ -21,7 +21,7 @@ export namespace Symbol {
|
|||
const len = inputStr.length;
|
||||
let i = 0;
|
||||
let cursor = 0;
|
||||
let endFoundIdx = 0;
|
||||
let endFoundIdx = -1;
|
||||
let hasNewline = false;
|
||||
let found;
|
||||
while (i < inputStr.length) {
|
||||
|
|
@ -29,7 +29,6 @@ export namespace Symbol {
|
|||
for (const symbol in REPLACEABLE) {
|
||||
if (inputStr.startsWith(symbol, i)) {
|
||||
result.push(REPLACEABLE[symbol]);
|
||||
console.log(REPLACEABLE[symbol]);
|
||||
cursor += REPLACEABLE[symbol].length;
|
||||
i += symbol.length;
|
||||
found = true;
|
||||
|
|
@ -55,7 +54,7 @@ export namespace Symbol {
|
|||
let data = result.join("");
|
||||
let info = {
|
||||
hasNewline,
|
||||
cursorEnd: data.length - endFoundIdx,
|
||||
cursorEnd: endFoundIdx < 0 ? 0 : data.length - endFoundIdx,
|
||||
};
|
||||
|
||||
return { data, info };
|
||||
|
|
|
|||
Loading…
Reference in a new issue