From 7b7621cc9c08cea6226decb5f4384bc686aa2d0f Mon Sep 17 00:00:00 2001 From: Sasial <44125644+sasial-dev@users.noreply.github.com> Date: Fri, 19 Jul 2024 17:36:00 +1000 Subject: [PATCH 1/2] fix(TextBoundsParams): add `RichText` field --- packages/ui/src/components/suggestions/suggestions.tsx | 6 +++++- packages/ui/src/components/suggestions/util.ts | 2 ++ packages/ui/src/components/terminal-window.tsx | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/components/suggestions/suggestions.tsx b/packages/ui/src/components/suggestions/suggestions.tsx index 61eb58b4..412ad7a8 100644 --- a/packages/ui/src/components/suggestions/suggestions.tsx +++ b/packages/ui/src/components/suggestions/suggestions.tsx @@ -42,7 +42,11 @@ export function Suggestions() { }, [terminalText]); const textBoundsParams = useMemo( - () => new Instance("GetTextBoundsParams"), + () => { + const instance = new Instance("GetTextBoundsParams"); + instance.RichText = true; + return instance + }, [], ); diff --git a/packages/ui/src/components/suggestions/util.ts b/packages/ui/src/components/suggestions/util.ts index 2beb2186..2094949f 100644 --- a/packages/ui/src/components/suggestions/util.ts +++ b/packages/ui/src/components/suggestions/util.ts @@ -7,6 +7,8 @@ import { import { SuggestionTextBounds } from "./types"; const TEXT_BOUNDS_PARAMS = new Instance("GetTextBoundsParams"); +TEXT_BOUNDS_PARAMS.RichText = true; + const DEFAULT_BOUNDS = new Vector2(); let prevColor: Color3 | undefined; diff --git a/packages/ui/src/components/terminal-window.tsx b/packages/ui/src/components/terminal-window.tsx index 7390d434..c577ab35 100644 --- a/packages/ui/src/components/terminal-window.tsx +++ b/packages/ui/src/components/terminal-window.tsx @@ -49,6 +49,7 @@ export function TerminalWindow() { const textBoundsParams = useMemo(() => { const params = new Instance("GetTextBoundsParams"); + params.RichText = true; params.Width = math.huge; params.Font = options.font.regular; return params; From 07ee08f58dd96401fb4c0ca34f35c6eb47c2586f Mon Sep 17 00:00:00 2001 From: Sasial <44125644+sasial-dev@users.noreply.github.com> Date: Fri, 19 Jul 2024 17:43:23 +1000 Subject: [PATCH 2/2] chore: fix CI --- .../ui/src/components/suggestions/suggestions.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/ui/src/components/suggestions/suggestions.tsx b/packages/ui/src/components/suggestions/suggestions.tsx index 412ad7a8..3e59a2d8 100644 --- a/packages/ui/src/components/suggestions/suggestions.tsx +++ b/packages/ui/src/components/suggestions/suggestions.tsx @@ -41,14 +41,11 @@ export function Suggestions() { return terminalText.parts[terminalText.index]; }, [terminalText]); - const textBoundsParams = useMemo( - () => { - const instance = new Instance("GetTextBoundsParams"); - instance.RichText = true; - return instance - }, - [], - ); + const textBoundsParams = useMemo(() => { + const params = new Instance("GetTextBoundsParams"); + params.RichText = true; + return params; + }, []); // Suggestions const currentSuggestion = useSelector(selectSuggestion);