Skip to content

Commit

Permalink
fix(ui): add RichText field (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
sasial-dev authored Jul 19, 2024
1 parent f967091 commit 9a4ed16
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/ui/src/components/suggestions/suggestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ export function Suggestions() {
return terminalText.parts[terminalText.index];
}, [terminalText]);

const textBoundsParams = useMemo(
() => new Instance("GetTextBoundsParams"),
[],
);
const textBoundsParams = useMemo(() => {
const params = new Instance("GetTextBoundsParams");
params.RichText = true;
return params;
}, []);

// Suggestions
const currentSuggestion = useSelector(selectSuggestion);
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/components/suggestions/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/terminal-window.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9a4ed16

Please sign in to comment.