fixed: detection of last tag

This commit is contained in:
quenousimporte 2023-01-30 14:53:42 +01:00
parent d0c6693ff7
commit 2d30055274
1 changed files with 5 additions and 5 deletions

12
main.js
View File

@ -602,7 +602,7 @@ function linkatpos()
function tagatpos()
{
if (md.value.lastIndexOf("tags: ", md.selectionStart) < md.value.lastIndexOf("\n", md.selectionStart))
if (md.value.lastIndexOf("tags: ", md.selectionStart) < md.value.lastIndexOf("\n", md.selectionStart) || md.selectionStart < 6)
{
return null;
}
@ -610,13 +610,13 @@ function tagatpos()
var start = md.value.lastIndexOf(" ", md.selectionStart);
if (start == -1 || md.value.substring(start, md.selectionStart).indexOf("\n") != -1) return "";
var eol = md.value.indexOf("\n", md.selectionStart);
var end = md.value.indexOf(",", md.selectionStart);
if (end == -1)
{
end = md.value.indexOf("\n", md.selectionStart);
}
if (end == -1 || md.value.substring(md.selectionStart, end).indexOf("\n") != -1) return "";
if (end == -1 || eol < end)
{
end = eol;
}
return md.value.substring(start + 1, end);
}