Fix debugger entity inspect newlines #97
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 of1
) 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 at1
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:
🟢 After: