-
-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Is there an existing issue for this?
- I have searched the existing issues
Midnight Commander version and build configuration
4.8.33, gitOperating system
.Is this issue reproducible using the latest version of Midnight Commander?
- I confirm the issue is still reproducible with 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