Change the bit fiddling of the LSB to use the sign bit of the short type. This leaves one more bit for the line count.
New patch attached. Use a char type for the screen line number count. This patch fixes bug 3590540.
I don't understand the documentation comment on line 153 of ScreenLineManager:
* x == 0 -> invalid entry
* x >= 0 -> valid entries
Are you referring to the value of screenLines[x] ? what is x?
I don't understand how you get another bit for anything when you change a short to char.
I thought short was twice as big as char?
1.) "Are you referring to the value of screenLines[x] ? what is x?"
x is the value of screenLine[lineNumber].
- when screenLine[lineNumber] == 0 -> this entry is not valid. the physical line needs to be tokenized and the number of screen lines that this physical line will have needs to be calculated.
- when screenLine[lineNumber] > 0 -> this entry is valid and the number of screen lines for this physical line were already calculated.
2.) "I thought short was twice as big as char?"
char and short are both 16 bit wide. char is unsigned and short is signed.
sorry about the short/char confusion. Need more coffee this morning.
You can commit this directly after a s/x/screenLines[lineNumber]/ in the doc comments as we both discussed.
Commited as r22629