FIX: Allow hashtag autocomplete at start of line (#19216)

Back when we introduced hashtag autocomplete in
c1dbf5c1c4 we had to
disallow triggering it using # at the start of the
line because our old markdown engine rendered headers
with `#abc`, but now our new engine does `# abc` so
it is safe to allow hashtag autocompletion straight
away.
This commit is contained in:
Martin Brennan 2022-11-29 10:56:17 +10:00 committed by GitHub
parent 787655e276
commit 6f0b9bb1c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 7 deletions

View File

@ -50,11 +50,9 @@ export function setupHashtagAutocomplete(
export function hashtagTriggerRule(textarea, opts) {
const result = caretRowCol(textarea);
const row = result.rowNum;
let col = result.colNum;
let line = textarea.value.split("\n")[row - 1];
if (opts && opts.backSpace) {
col = col - 1;
line = line.slice(0, line.length - 1);
// Don't trigger autocomplete when backspacing into a `#category |` => `#category|`
@ -63,11 +61,6 @@ export function hashtagTriggerRule(textarea, opts) {
}
}
// Don't trigger autocomplete when ATX-style headers are used
if (col < 6 && line.slice(0, col) === "#".repeat(col)) {
return false;
}
if (inCodeBlock(textarea.value, caretPosition(textarea))) {
return false;
}