8000 Rotating dash not removed · Issue #2163 · MidnightCommander/mc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotating dash not removed #2163

Closed
mc-butler opened this issue May 3, 2010 · 21 comments
Closed

Rotating dash not removed #2163

mc-butler opened this issue May 3, 2010 · 21 comments
Assignees
Labels
area: core Issues not related to a specific subsystem prio: low Minor problem or easily worked around ver: 4.7.0.4 Reproducible in version 4.7.0.4
Milestone

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/2163
Reporter egmont (@egmontkob)

When reading a large directory, mc shows a rotating dash in the upper right corner (if enabled in the config). This symbol is not removed when mc finishes reading the directory. (It disappears on a subsequent Ctrl-R or window resize, though).

The easiest way to test it: stand on a directory, press and hold the Enter key for a long time (mc toggles back and forth between two directories).

When mc finishes reading a directory, it should remove the rotating dash.

Note

Original attachments:

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Oct 31, 2011 at 11:01 UTC (comment 1)

  • Branch state set to no branch
  • Milestone changed from 4.7 to Future Releases
  • Priority changed from minor to trivial

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on May 19, 2013 at 23:01 UTC

remove rotating dash when finished rotating

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on May 19, 2013 at 23:15 UTC (comment 2)

This has been bugging me forever, and I don't know why I didn't take time to fix it much earlier. My system is fast enough that I rarely see the dash actually rotating, but I'm always disturbed by the artifact it leaves behind, it just looks ugly to me.

Could you please review the patch?

Whenever rotating the dash finishes, I redraw the character that should be there. I believe there are 2 cases only: if the menubar is shown (then it's a space char, using menubar color), or if it's hidden (then it's the upper right corner of the panel, using the main color).

[As a really minor bug, if the menubar is shown but the terminal is way too narrow to show it fully (e.g. less than 42 chars wide in English), I print a space although a letter (the last visible one from the cropped menubar line) should be printed. Honestly I don't care about it as mc is useless anyways on such narrow terminals :) ]

As a side note, I inverted the boolean arg of find_rotate_dash() to be consistent with the new rotate_dash() behavior and to be intuitive. For me, FALSE meaning to show something and TRUE meaning to hide it was counter-intuitive. I couldn't figure out where this rotating dash appears, though.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on May 25, 2013 at 8:20 UTC (comment 2.3)

  • Status changed from new to accepted
  • Milestone changed from Future Releases to 4.8.9
  • Branch state changed from no branch to on review
  • Owner set to andrew_b

Replying to egmont:

Could you please review the patch?

In general, patch is OK. Thanks!

Whenever rotating the dash finishes, I redraw the character that should be there. I believe there are 2 cases only: if the menubar is shown (then it's a space char, using menubar color), or if it's hidden (then it's the upper right corner of the panel, using the main color).

[As a really minor bug, if the menubar is shown but the terminal is way too narrow to show it fully (e.g. less than 42 chars wide in English), I print a space although a letter (the last visible one from the cropped menubar line) should be printed. Honestly I don't care about it as mc is useless anyways on such narrow terminals :) ]

I moved dash to the corner of the right/top panel from the corner of the screen. Menubar is untouched now.

As a side note, I inverted the boolean arg of find_rotate_dash() to be consistent with the new rotate_dash() behavior and to be intuitive. For me, FALSE meaning to show something and TRUE meaning to hide it was counter-intuitive. I couldn't figure out where this rotating dash appears, though.

This part of your patch I applied with small modifications as a separate commit.

Branch: 2163_rotating_dash.
Initial [941f9a279a596bd9c11ebc73aa6e780999fb6c3a].

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on May 25, 2013 at 9:12 UTC (comment 4)

Thanks! One thing, though, please do

- pos = (pos + 1) % sizeof (rotating_dash); 
+ pos = (pos + 1) % (sizeof (rotating_dash) - 1); 

sizeof() counts the terminating zero, hence a 5th phase, a caret also shows up.

I'm not sure about the widget infrastructure of mc, but are you sure that using midnight_dlg does not interfere with any actual dialog that might be open while the dash is rotated? (If you're sure then that's okay! :))

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on May 25, 2013 at 10:09 UTC (comment 4.5)

Replying to egmont:

sizeof() counts the terminating zero

Indeed.
In case of

const char rotating_dash[] = "|/-\\";

sizeof (rotating_dash) == 5.

In case of

const char *rotating_dash = "|/-\\";

sizeof (rotating_dash) == 4.

I changed declaration of rotating_dash.

I'm not sure about the widget infrastructure of mc, but are you sure that using midnight_dlg does not interfere with any actual dialog that might be open while the dash is rotated? (If you're sure then that's okay! :))

I hope everything is OK here. :)

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on May 25, 2013 at 10:21 UTC (comment 6)

I believe in case of

char *rotating_dash = "|/-\\";

sizeof(rotating_dash) accidentally happens to be 4 because the size of a pointer is 4 bytes, and not because the length of the string contained there is 4.

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on May 25, 2013 at 10:27 UTC (comment 7)

Yup, sizeof(rotating_dash) == 8 on x86-84.

Please stick to the [] declaration (that's when the length can be known in compile time) and the -1 offset. Or the hardwired 4 :) Or you can do

char rotating_dash[4] = "|/-\\"

in which case the trailing zero is not stored in memory at all and then sizeof gives 4, but you still have to manually maintain the length in that declaration line.

In case of "char *" the length might change at runtime hence sizeof() (which is evaluated at compile time) has no chance of knowing it, and it would be weird if the "const" modifier changed the behavior of sizeof().

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on May 25, 2013 at 11:27 UTC (comment 7.8)

Replying to egmont:

Please stick to the [] declaration (that's when the length can be known in compile time) and the -1 offset. Or the hardwired 4 :) Or you can do

char rotating_dash[4] = "|/-\\"

in which case the trailing zero is not stored in memory at all and then sizeof gives 4, but you still have to manually maintain the length in that declaration line.

Ok. Thanks.

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on May 25, 2013 at 13:41 UTC (comment 9)

It's cool now, thx!

@mc-butler
Copy link
Author
8000

Changed by zaytsev (@zyv) on May 26, 2013 at 13:01 UTC (comment 10)

You guys are doing awesome work! Just so that you know...

@mc-butler
Copy link
Author

Changed by mike.dld (mikedld@….com) on May 26, 2013 at 13:43 UTC (comment 11)

It is still possible to get sizeof() == 4, not hard-code any magic numbers and make the variable immutable at the same time. The code would look like this:

const char rotating_dash[] = { '|', '/', '-', '\\' };

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on May 26, 2013 at 19:03 UTC (comment 12)

Good point, Mike!

@mc-butler
Copy link
Author

Changed by angel_il (@ilia-maslakov) on Jun 28, 2013 at 19:05 UTC (comment 13)

  • Votes set to angel_il

@mc-butler
Copy link
Author

Changed by slavazanko (@slavaz) on Jul 2, 2013 at 12:29 UTC (comment 14)

  • Votes changed from angel_il to angel_il slavazanko
  • Branch state changed from on review to approved

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jul 2, 2013 at 17:05 UTC (comment 15)

  • Resolution set to fixed
  • Branch state changed from approved to merged
  • Status changed from accepted to testing
  • Votes changed from angel_il slavazanko to committed-master

Merged to master: [d38589c].

git log --pretty=oneline 368a303..d38589c

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Jul 2, 2013 at 17:09 UTC (comment 16)

  • Status changed from testing to closed

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on Aug 26, 2013 at 23:47 UTC (comment 17)

  • Status changed from closed to reopened
  • Resolution fixed deleted

Unfortunately the fix is not complete yet. The rotating dash is now drawn by using a widget which is not resized when mc is resized. So if you make mc's terminal wider, the rotating dash and the box corner when it's removed is drawn at an incorrect position.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Aug 27, 2013 at 10:02 UTC (comment 18)

Strange.
It should be fixed in [a365be6].

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on Aug 27, 2013 at 10:34 UTC (comment 19)

Oops, sorry. My bad. It is indeed fixed.

(I forgot that I had downgraded to 4.8.9 because #3047 was driving me crazy.)

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Aug 27, 2013 at 11:03 UTC (comment 20)

  • Resolution set to fixed
  • Status changed from reopened to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues not related to a specific subsystem prio: low Minor problem or easily worked around ver: 4.7.0.4 Reproducible in version 4.7.0.4
Development

No branches or pull requests

2 participants
0