Bug #7674
FILL-IN for a character variable: cannot delete an unknown value
0%
History
#1 Updated by Vladimir Tsichevski 9 months ago
FILL-IN
for a character variable: if the screen-value
is set to an unknown value, the screen value is replaced by the ?
sign (expected).
Now it is impossible to delete this ?
sign neither with the DELETE
nor with the BACKSPACE
key, which is not expected.
#2 Updated by Vladimir Tsichevski 9 months ago
The boolean StringFormat:unknownValueDisplayed
field should handle the situation then no screen buffer is allocated for the screen value, but the ?
sign is displayed.
This field is set when when the user presses the ?
character.
But this field is not affected when the SCREEN-VALUE
is set to unknown.
#3 Updated by Vladimir Tsichevski 9 months ago
- Status changed from New to WIP
The fix: set the unknownValueDisplayed
value in the StringFormat.CharBuf
constructor in case an unknown variable was passed as an argument:
public CharBuf(character varChar, boolean forFieldValue) { this.forFieldValue = forFieldValue; if (!varChar.isUnknown()) { // initialize our buffer of the proper maximum length buf = new StringBuilder(maxPresLength); String text = varChar.getValue(); if (forFieldValue) { parseFieldValue(text); } else { parseScreenValue(text); } } else { unknownValueDisplayed = true; } }
The corresponding diff:
=== modified file 'src/com/goldencode/p2j/ui/client/format/StringFormat.java' --- src/com/goldencode/p2j/ui/client/format/StringFormat.java 2022-09-08 11:25:35 +0000 +++ src/com/goldencode/p2j/ui/client/format/StringFormat.java 2023-08-11 10:40:10 +0000 @@ -1006,6 +1006,10 @@ parseScreenValue(text); } } + else + { + unknownValueDisplayed = true; + } } /**
#4 Updated by Vladimir Tsichevski 9 months ago
- Status changed from WIP to Review
Please, review the fix.
#6 Updated by Vladimir Tsichevski 9 months ago
Greg Shah wrote:
Is this task related to an existing customer bug? If so, please link them.
This issue prevents automating testing of other bugs.
#8 Updated by Eugenie Lyzenko 9 months ago
Greg Shah wrote:
Eugenie/Hynek: Please review.
I have no objections.
#9 Updated by Hynek Cihlar 9 months ago
To me the change looks suspicious. The change addresses an issue, which is related to the screen-value
use case. But CharBuf
is used in many other contexts where the unknown
value may not be represented with a "?" char. Look in CharBuf.toVar
, for buf == null
the var is either set to unknown
or to "?". Setting the unknownValueDisplayed
unconditionally in CharBuf.CharBuf
just doesn't seem right. I suggest you do a good amount of regression testing (both ChUI and GUI) before merging this change to trunk.
#10 Updated by Vladimir Tsichevski 9 months ago
Hynek Cihlar wrote:
To me the change looks suspicious. The change addresses an issue, which is related to the
screen-value
use case. ButCharBuf
is used in many other contexts where theunknown
value may not be represented with a "?" char. Look inCharBuf.toVar
, forbuf == null
the var is either set tounknown
or to "?".
The code you mentioned: I cannot get what does this mean:
if (unknownValueDisplayed) { varChar.assign("?"); } varChar.setUnknown();
The variable is first assigned the ?
character value, then is unconditionally reset to unknown. Why is this?
#11 Updated by Hynek Cihlar 9 months ago
Vladimir Tsichevski wrote:
The variable is first assigned the
?
character value, then is unconditionally reset to unknown. Why is this?
This is clearly not correct. But it shows the code execution should likely branch for the representation of unknown value.