Is there an existing issue for this?
Midnight Commander version and build configuration
Operating system
Is this issue reproducible using the latest version of Midnight Commander?
How to reproduce
src/editdraw.c edit_draw_this_line() contains this:
switch (c)
{
[...]
case '\t':
{
[...]
style = c | (book_mark << 16);
I believe this is the only place where style's low byte is used. It's assigned the value of c which is \t = 9, which happens to be single-byte, so no harm done.
As I'm looking at the code, it seems to me that the low byte is not assigned anywhere else, and is never read.
The next byte is used for various MOD_* flags, and the third byte stores the color pair id.
I guess this could be leftover code from pre-UTF-8 days where the character was also stored in this variable, but later moved to its own field in line_s??
If I'm right then that c | is misleading and should preferably be removed. To be double-checked that I'm not misreading the code.
Also:
In print_to_widget(), the declaration and assignment style = p->style & 0xFF00; is not needed. The value is only used 5 times, each time to check for one of the MOD_* bits. For that, we could use p->style directly, and there's no need to chop off the non-MOD_* bits.
Expected behavior
.
Actual behavior
.
Additional context
No response
Is there an existing issue for this?
Midnight Commander version and build configuration
Operating system
.Is this issue reproducible using the latest version of Midnight Commander?
How to reproduce
src/editdraw.cedit_draw_this_line()contains this:I believe this is the only place where
style's low byte is used. It's assigned the value ofcwhich is\t= 9, which happens to be single-byte, so no harm done.As I'm looking at the code, it seems to me that the low byte is not assigned anywhere else, and is never read.
The next byte is used for various
MOD_*flags, and the third byte stores the color pair id.I guess this could be leftover code from pre-UTF-8 days where the character was also stored in this variable, but later moved to its own field in
line_s??If I'm right then that
c |is misleading and should preferably be removed. To be double-checked that I'm not misreading the code.Also:
In
print_to_widget(), the declaration and assignmentstyle = p->style & 0xFF00;is not needed. The value is only used 5 times, each time to check for one of theMOD_*bits. For that, we could usep->styledirectly, and there's no need to chop off the non-MOD_*bits.Expected behavior
.
Actual behavior
.
Additional context
No response