Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatter: fix rendering of empty maps #1109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

patapenka-alexey
Copy link
Contributor

Closes #1102

@patapenka-alexey patapenka-alexey marked this pull request as ready for review February 24, 2025 12:51
@patapenka-alexey patapenka-alexey added the full-ci Enables full ci tests label Feb 24, 2025
@patapenka-alexey patapenka-alexey removed the full-ci Enables full ci tests label Feb 25, 2025
@patapenka-alexey patapenka-alexey force-pushed the patapenka-alexey/gh-1102-empty-table-crash branch 2 times, most recently from d3aeeb9 to e91b608 Compare February 25, 2025 06:58
itemMap.insert(strconv.Itoa(i+1), item[i])
} else {
itemMap.insert(strconv.Itoa(i+1), "")
if maxLen > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if maxLen > 0 {
if maxLen == 0 {
return "", nil
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooops. Thanks!

Comment on lines +314 to +322
{
// when user typed to console:
// localhost:xxxx> \set output table
// localhost:xxxx> {}
formatter.TableFormat,
"{}",
"\n",
false,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, add tests with {}, {}; {{}}; {{}, {}}

@patapenka-alexey patapenka-alexey force-pushed the patapenka-alexey/gh-1102-empty-table-crash branch from e91b608 to b9767dd Compare February 25, 2025 17:48
@patapenka-alexey patapenka-alexey force-pushed the patapenka-alexey/gh-1102-empty-table-crash branch from b9767dd to f37087d Compare February 25, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tt connect Panic on render empty table with table/ttable output format
4 participants