Skip to content

🎨 Palette: Add trailing space to generic input prompts#698

Merged
abhimehro merged 1 commit intomainfrom
palette/trailing-space-prompts-7855502334136946876
Apr 3, 2026
Merged

🎨 Palette: Add trailing space to generic input prompts#698
abhimehro merged 1 commit intomainfrom
palette/trailing-space-prompts-7855502334136946876

Conversation

@abhimehro
Copy link
Copy Markdown
Owner

💡 What: Added logic to automatically append a trailing space to prompt strings in get_validated_input and get_password if one is missing.

🎯 Why: When prompting users for input via generic wrappers, if the prompt string lacks a trailing space, the user's typed input visually collides with the prompt text. This creates a cluttered and confusing user experience.

Accessibility: Improves readability for visually impaired users and screen readers by ensuring distinct separation between the system's prompt and the user's input.

(Also recorded critical learnings regarding generic input cancellation safety in .Jules/palette.md).


PR created automatically by Jules for task 7855502334136946876 started by @abhimehro

…t collision

Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings April 3, 2026 17:05
@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Apr 3, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions github-actions Bot added documentation Improvements or additions to documentation python labels Apr 3, 2026
Copy link
Copy Markdown

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gates Passed
6 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CLI prompt readability by ensuring generic input wrappers always separate the prompt text from the user’s typed input with a trailing space, preventing visual “prompt/input collision” in interactive runs.

Changes:

  • Auto-append a trailing space to prompt in get_validated_input() when missing.
  • Auto-append a trailing space to prompt in get_password() when missing.
  • Document prompt-collision and generic-input cancellation safety learnings in .Jules/palette.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
main.py Ensures input()/getpass() prompts rendered via shared wrappers end with a trailing space for clearer UX.
.Jules/palette.md Records UX and safety learnings about prompt formatting and cancellation handling scope.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces automatic trailing space appending to input prompts in main.py and updates the .Jules/palette.md documentation with learnings on prompt collision and cancellation safety. Feedback recommends using .isspace() for a more robust whitespace check in the prompt handling logic to avoid redundant spacing and suggests consolidating the new documentation entries to avoid redundancy with existing content.

Comment thread main.py
Comment on lines +770 to +771
if not prompt.endswith(" "):
prompt += " "
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using .endswith(" ") only checks for a literal trailing space. If the prompt ends with other whitespace characters like a newline (\n) or a tab (\t), this logic will append an unnecessary extra space. Using .isspace() on the last character is more robust as it ensures any form of whitespace separation is respected, preventing redundant spaces in those cases.

Suggested change
if not prompt.endswith(" "):
prompt += " "
if prompt and not prompt[-1].isspace():
prompt += " "

Comment thread main.py
Comment on lines +800 to +801
if not prompt.endswith(" "):
prompt += " "
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using .endswith(" ") only checks for a literal trailing space. If the prompt ends with other whitespace characters like a newline (\n) or a tab (\t), this logic will append an unnecessary extra space. Using .isspace() on the last character is more robust as it ensures any form of whitespace separation is respected, preventing redundant spaces in those cases.

Suggested change
if not prompt.endswith(" "):
prompt += " "
if prompt and not prompt[-1].isspace():
prompt += " "

Comment thread .Jules/palette.md
Comment on lines +36 to +39
## 2025-03-24 - [Input Prompt Collision]

**Learning:** When prompting users for input via generic wrappers (e.g., `input()` or `getpass()`), if the prompt string lacks a trailing space, the user's typed input will visually collide with the prompt text, creating a poor aesthetic and confusing UX.
**Action:** Always append a trailing space automatically to prompt strings in generic input handler functions if one is not provided by the caller.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This new entry is largely redundant with the existing learning and action recorded on lines 33-34. While it specifies "generic wrappers", the core issue (visual collision) and the solution (trailing space) are already covered. Consider consolidating these entries to keep the palette file concise and maintainable.

@abhimehro abhimehro merged commit 37e28db into main Apr 3, 2026
18 checks passed
@abhimehro abhimehro deleted the palette/trailing-space-prompts-7855502334136946876 branch April 3, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants