Bug #109538 "segments" elements are removed willfully when terminal-width is small
Submitted: 5 Jan 2023 3:06 Modified: 5 Jan 2023 7:04
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:Shell General / Core Client Severity:S3 (Non-critical)
Version:8.0.31 OS:CentOS (7.9)
Assigned to: CPU Architecture:x86

[5 Jan 2023 3:06] Tsubasa Tanaka
Description:
I knew this behavior when customizing prompt by prompt.json.
When terminal-width is small, mysqlsh willfully trimed "segments" elements I set.

See "How to repeat" and I upload animation after the post.

How to repeat:

### Put prompt.json
$ cat ~/.mysqlsh/prompt.json
{
  "segments":
  [
    { "text": "segments11111111111111111111" },
    { "text": "segments22222222222222222222" },
    { "text": "segments33333333333333333333" },
    { "text": "segments44444444444444444444" }
  ],
  "prompt": { "text": "> " }
}

### Run mysqlsh and change terminal width
$ mysqlsh

// When terminal-width is enough
segments11111111111111111111 segments22222222222222222222 segments33333333333333333333 segments44444444444444444444>

// Smaller terminal-width than prompt length.
segments22222222222222222222 segments33333333333333333333 segments44444444444444444444>

// More smallter than last one.
segments44444444444444444444>

Suggested fix:
Wrap segments at terminal edge. Don't trim.
[5 Jan 2023 3:06] Tsubasa Tanaka
How to repeat

Attachment: bug109538.gif (image/gif, text), 772.09 KiB.

[5 Jan 2023 7:04] MySQL Verification Team
Hello tanaka-San,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh