-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
Laravel Prompts Version
0.3.5
Laravel Version
12.7.2
PHP Version
8.2.27
Operating System & Version
macOS 14.7.4
Terminal Application
zsh
Description
When using Laravel Prompts' select()
method with a nested foreground (<fg>
tag) element in the title, the prompt title renders incorrectly.
Steps to Reproduce:
Using the following code produces the issue:
$action = select("<fg=green>Your action, <fg=yellow>{$this->user->name}</>?</>", $actionOptions);
This renders incorrectly:

However, when using the following code (without nested foreground elements), it renders correctly:
$action = select("<fg=green>Your action, {$this->user->name}?</>", $actionOptions);
This renders correctly:

Expected Behavior:
Nested foreground elements should render correctly within the select title.
Actual Behavior:
Nested foreground elements cause incorrect rendering.
Additional Information:
- Laravel Prompts is being used within Laravel v12.7.2
- Issue reproducible consistently with nested tags
Suggested Fix:
Handle nested foreground formatting correctly in the prompt renderer or clarify limitations in the documentation if nested formatting isn't supported.
Steps To Reproduce
- Create a new Laravel project or use an existing Laravel 12.7.2 installation.
- Within a Laravel Command or Controller, include the following code snippet:
$actionOptions = ['Attack', 'Run', 'Mighty Blow (Deal 2x damage with a powerful strike)'];
$action = select("<fg=green>Your action, <fg=yellow>UserName</>?</>", $actionOptions);
- Run the Laravel command or controller action that executes this code.
- Observe the rendering of the prompt title in the terminal.
Metadata
Metadata
Assignees
Labels
No labels