Skip to content

Remove the insignificant zeros for non-data fields.#97

Open
raspopov wants to merge 1 commit intosanny32:devfrom
raspopov:enh-leading-zeros
Open

Remove the insignificant zeros for non-data fields.#97
raspopov wants to merge 1 commit intosanny32:devfrom
raspopov:enh-leading-zeros

Conversation

@raspopov
Copy link
Contributor

In the register window, the address and length input fields have insignificant zeros on the left, which is confusing because this is how numbers are represented in the octal number system.

This happens because the leading zeros display setting (enabled by default) is applied not only to the register map, but also to the address, length, and node number input fields for some reason.

The FormModSim::_leadingZeros class variable has been added.

@sanny32
Copy link
Owner

sanny32 commented Mar 14, 2026

This is by design. The leading zeros means that the field is designed for unsigned input.

@raspopov
Copy link
Contributor Author

This is by design. The leading zeros means that the field is designed for unsigned input.

And what purpose do those extra zeros serve?

And why, then, isn't that functionality included in the configuration dialog?

In the register window, the address and length input fields have
insignificant zeros on the left, which is confusing because this is how
numbers are represented in the octal number system. This happens because
the leading zeros display setting (enabled by default) is applied not
only to the register map, but also to the address, length, and node
number input fields for some reason.

The FormModSim::_leadingZeros class variable has been added.
@raspopov raspopov force-pushed the enh-leading-zeros branch from 3afe9cb to ff49d83 Compare March 14, 2026 09:44
@sanny32
Copy link
Owner

sanny32 commented Mar 14, 2026

And why, then, isn't that functionality included in the configuration dialog?

'Show leading zeros for unsigned values' option on/off leading zeros.

@raspopov
Copy link
Contributor Author

'Show leading zeros for unsigned values' option on/off leading zeros.

There are settings, of course, but that's not what I meant. Here's an explanatory image:

omodsim_2026-03-14_20-15-31

@sanny32
Copy link
Owner

sanny32 commented Mar 15, 2026

DisplayDefinition dialog will be changed or removed due to application redesign

@raspopov
Copy link
Contributor Author

'Show leading zeros for unsigned values'

However, the Address, Length, and Unit ID input fields are not unsigned values, nor are they values at all. I just can't figure out the logic...

@sanny32
Copy link
Owner

sanny32 commented Mar 15, 2026

However, the Address, Length, and Unit ID input fields are not unsigned values, nor are they values at all. I just can't figure out the logic...

In fact, they are unsigned values ​​because they cannot be less than zero.

@raspopov
Copy link
Contributor Author

In fact, they are unsigned values ​​because they cannot be less than zero.

Leading zeros in a number have no bearing on whether it is signed or unsigned, nor on how much memory it occupies. For example "-00123". 😎 Please explain what use case is implemented here.

@sanny32
Copy link
Owner

sanny32 commented Mar 16, 2026

Leading zeros in a number have no bearing on whether it is signed or unsigned

In my understanding, the leading zeros mean an unsigned type

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