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

Fix debugger entity inspect newlines #97

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

Nidoxs
Copy link
Contributor

@Nidoxs Nidoxs commented Aug 9, 2024

Proposed changes

At the moment the debugger view (specifically the entity inspector panel) adds a new-line both above and below the component data string thus taking up more vertical space in the components table. This change fixes that such that the table view is properly condensed by preventing unecessary newline characters being added to the component data strings (via formatTable)

Related issues

Fixes #70
Thanks @jackTabsCode for referring me to work on this issue, I'm glad the entity inspection panel will be a little more compact for us all now. 😄

Additional comments

Admittedly, the code changes for this are fairly ambiguous given that the tableFormatter is not as readable as it could be. The nature of this fix was to:

  • Check that the _depth value was more than 1 before attempting to add a \n character before the first table item. This _depth value (when it is of a value of 1) causes no curly braces to be displayed for the top level table (intended behaviour for the debugger view). However, this means that the piece of code that handled adding \n after each table item would also run when the _depth was at 1 which is why the debugger has always had extra space above and below table items.

  • Empty tables do not get carried down to a new line now, they remain on the same line. This further helps condense the entity inspector table.

Preview

🔴 Before:

image

🟢 After:

image
image

@jackTabsCode jackTabsCode requested a review from a team August 9, 2024 02:01
@jackTabsCode jackTabsCode merged commit 907ccc2 into matter-ecs:main Aug 9, 2024
6 checks passed
@Nidoxs Nidoxs deleted the debugger-newline-fix branch August 9, 2024 14:36
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.

Debugger table formatting has extra newlines at the top level
2 participants