Skip to content

Conversation

@jbencina
Copy link
Contributor

@jbencina jbencina commented Jan 18, 2025

Summary

The current implementation of modeslive on terminal screens creates difficult to read formatting due to floating point precision larger than the defined column widths. This PR makes an adjustment to round floating point numbers to the defined column width to improve readability. This resolves issue #178

This behavior may have been caused by #147. For visual user output it probably makes sense to at least keep some formatting in the terminal view. This PR does not affect any other internal calculations or the dump output.

The logic is:

  • Determine if there is a negative sign in the output
  • Account for the decimal point
  • From the column width, subtract the negative sign, decimal, and one extra space to allow spacing between columns.
  • Round the floating point rather than truncating for additional accuracy
  • Use string formatting to maintain trailing zeros for visual improvement

Testing Done

Before: Fields not aligned with columns and spilling around

image

After: Fields behave correctly.
image

Confirmed no impact to --dump output

@junzis junzis merged commit a4c6d01 into junzis:master Feb 9, 2025
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.

2 participants