fix: Klick-Erkennung des Abhängigkeits-Sprungs akzeptiert \s wie der Parser (D67)
Vor dem `:#…`-Token prüfte depIdAt nur Space/Tab, der Parser jedes \s — vor einem geschützten Leerzeichen war das Token damit eine Abhängigkeit, auf die Strg+Klick nichts tat. Test mit echtem NBSP; Gegenprobe: die alte Prüfung lässt genau ihn fallen. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
7236850f2b
commit
9999c7973e
@@ -19,6 +19,7 @@ reverse.
|
|||||||
|
|
||||||
## 2026-08-25
|
## 2026-08-25
|
||||||
|
|
||||||
|
- Fix: Ctrl+click on a dependency preceded by a non-breaking space did nothing, although the parser reads it as a dependency
|
||||||
- Ctrl+click a dependency `:#id` in the text jumps to the line that defines the ID — Ctrl+Enter does the same at the caret
|
- Ctrl+click a dependency `:#id` in the text jumps to the line that defines the ID — Ctrl+Enter does the same at the caret
|
||||||
|
|
||||||
## 2026-08-24
|
## 2026-08-24
|
||||||
|
|||||||
@@ -103,8 +103,11 @@ export function depIdAt(text, caret){
|
|||||||
let m;
|
let m;
|
||||||
while((m = DEP_TOKEN_G.exec(head))){
|
while((m = DEP_TOKEN_G.exec(head))){
|
||||||
const p = m.index;
|
const p = m.index;
|
||||||
/* Alleinstehend angesetzt — `(:#a,#b)` bleibt damit Zitat (§1/D37). */
|
/* Alleinstehend angesetzt — `(:#a,#b)` bleibt damit Zitat (§1/D37).
|
||||||
if(p !== idEnd && p > 0 && !/[ \t]/.test(head[p - 1])) continue;
|
`\s` wie im Parser, nicht nur Space/Tab: Auch vor einem geschützten
|
||||||
|
Leerzeichen (etwa aus einer Web-Seite kopiert) ist das Token eine
|
||||||
|
Abhängigkeit, und der Sprung muss dieselbe Zeile lesen wie der Parser. */
|
||||||
|
if(p !== idEnd && p > 0 && !/\s/.test(head[p - 1])) continue;
|
||||||
const end = p + m[0].length;
|
const end = p + m[0].length;
|
||||||
if(col < p || col > end) continue;
|
if(col < p || col > end) continue;
|
||||||
let s = p + 1; /* hinter dem `:` */
|
let s = p + 1; /* hinter dem `:` */
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ describe('depIdAt — die ID unter der Schreibmarke (D67)', () => {
|
|||||||
expect(depIdAt(...at('- Front|end :#api'))).toBe(null);
|
expect(depIdAt(...at('- Front|end :#api'))).toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('geschütztes Leerzeichen vor dem Token zählt wie beim Parser als Leerraum', () => {
|
||||||
|
expect(depIdAt(...at('- X :#a|uth'))).toBe('auth');
|
||||||
|
});
|
||||||
|
|
||||||
it('in einer Fortsetzungszeile (D59) wird das Token erkannt', () => {
|
it('in einer Fortsetzungszeile (D59) wird das Token erkannt', () => {
|
||||||
expect(depIdAt(...at('- Langer Knoten \\\n :#a|pi'))).toBe('api');
|
expect(depIdAt(...at('- Langer Knoten \\\n :#a|pi'))).toBe('api');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user