GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(composer): open @, #, $, and / menus after CJK full-width spaces … · patroza/t3code@57b0227

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src
    • composer-logic.test.ts
    • composer-logic.ts
  • packages/shared/src
    • composerTrigger.test.ts
    • composerTrigger.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/composer-logic.test.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/composer-logic.test.ts
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,24 @@ describe("composerSubmissionIntentForKey", () => {
269269
});
270270

271271
describe("detectComposerTrigger", () => {
272+
it.each(["\u3000", "\u00a0"])("detects completion after Unicode space %j", (space) => {
273+
for (const [token, kind, query] of [
274+
["@src", "path", "src"],
275+
["#123", "pull-request", "123"],
276+
["$review", "skill", "review"],
277+
["/model", "slash-command", "model"],
278+
]) {
279+
const prefix = `日本語${space}`;
280+
const text = `${prefix}${token}`;
281+
expect(detectComposerTrigger(text, text.length)).toEqual({
282+
kind,
283+
query,
284+
rangeStart: prefix.length,
285+
rangeEnd: text.length,
286+
});
287+
}
288+
});
289+
272290
it.each([
273291
["Run /tmp/build.sh", "Run /tmp/build.sh".length],
274292
["/etc/hosts", "/etc/hosts".length],
Collapse file

‎apps/web/src/composer-logic.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/composer-logic.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function clampCursor(text: string, cursor: number): number {
109109
}
110110

111111
function isWhitespace(char: string): boolean {
112-
return char === " " || char === "\n" || char === "\t" || char === "\r";
112+
return /\s/.test(char);
113113
}
114114

115115
function tokenStartForCursor(text: string, cursor: number): number {
Collapse file

‎packages/shared/src/composerTrigger.test.ts‎

Copy file name to clipboardExpand all lines: packages/shared/src/composerTrigger.test.ts
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ function parsedLinkLabel(markdown: string): string | undefined {
2525
}
2626

2727
describe("detectComposerTrigger", () => {
28+
it.each(["\u3000", "\u00a0"])("detects completion after Unicode space %j", (space) => {
29+
for (const [token, kind, query] of [
30+
["@src", "path", "src"],
31+
["#123", "pull-request", "123"],
32+
["$review", "skill", "review"],
33+
["/model", "slash-command", "model"],
34+
]) {
35+
const prefix = `日本語${space}`;
36+
const text = `${prefix}${token}`;
37+
expect(detectComposerTrigger(text, text.length)).toEqual({
38+
kind,
39+
query,
40+
rangeStart: prefix.length,
41+
rangeEnd: text.length,
42+
});
43+
}
44+
});
45+
2846
it.each([
2947
["Run /tmp/build.sh", "Run /tmp/build.sh".length],
3048
["/etc/hosts", "/etc/hosts".length],
Collapse file

‎packages/shared/src/composerTrigger.ts‎

Copy file name to clipboardExpand all lines: packages/shared/src/composerTrigger.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function clampCursor(text: string, cursor: number): number {
6464
}
6565

6666
function isWhitespace(char: string): boolean {
67-
return char === " " || char === "\n" || char === "\t" || char === "\r";
67+
return /\s/.test(char);
6868
}
6969

7070
/** A second slash or backslash makes the whole word a path, even when the caret precedes it. */

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.