url: smartparens hack

support urls like (https://jb55.com/something)
This commit is contained in:
William Casarin
2023-08-06 14:16:43 -07:00
parent de58e52199
commit 9e6fbeefcd
2 changed files with 19 additions and 1 deletions

View File

@@ -192,7 +192,17 @@ static int parse_url(struct cursor *cur, struct note_block *block) {
cur->p = start;
return 0;
}
// smart parens
if (start - 1 >= 0 &&
start < cur->end &&
*(start - 1) == '(' &&
(cur->p - 1) < cur->end &&
*(cur->p - 1) == ')')
{
cur->p--;
}
block->type = BLOCK_URL;
block->block.str.start = (const char *)start;
block->block.str.end = (const char *)cur->p;