Skip to content

Conversation

@egmontkob
Copy link
Contributor

This broke in recent commit e99555c.

Proposed changes

Use named indices rather than just listing the struct items which can easily go out of sync.

For consistency, moved the code to where other similar structs are initialized.

Checklist

👉 Our coding style can be found here: https://midnight-commander.org/coding-style/ 👈

  • I have referenced the issue(s) resolved by this PR (if any)
  • I have signed-off my contribution with git commit --amend -s
  • Lint and unit tests pass locally with my changes (make indent && make check)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

This broke in recent commit e99555c.

Signed-off-by: Egmont Koblinger <egmont@gmail.com>
@github-actions github-actions bot added needs triage Needs triage by maintainers prio: medium Has the potential to affect progress labels Nov 28, 2025
@github-actions github-actions bot added this to the Future Releases milestone Nov 28, 2025
@egmontkob egmontkob requested a review from mc-worker November 28, 2025 08:00
@egmontkob egmontkob added area: tty Interaction with the terminal, screen libraries and removed needs triage Needs triage by maintainers labels Nov 28, 2025
@egmontkob egmontkob modified the milestones: Future Releases, 4.8.34 Nov 28, 2025
@mc-worker
Copy link
Contributor

help_colors is still used in the help_interactive_display() function only. Why did you introduce a global variable instead of fixing the local one?

@egmontkob
Copy link
Contributor Author

egmontkob commented Nov 29, 2025

listbox_colors is also only used at one place, yet is defined globally. Thus moving help_colors here makes the code more consistent: fewer different patterns seen at how various dlg_colors_t structures are defined.

The old code layout here is obviously pretty fragile; if I simply added a few new members to the current assignment then it could easily break later on, just as it did now. So I definitely wanted to have a syntax where each value is clearly assigned to its proper and explicitly spelled out index. Keeping help_colors's assignment at its current location would only have been possible using runtime (i.e. non-const) assignment which is run over and over again, something that seems to me isn't really liked by mc's current coding practice. help.c doesn't have an init() method either where I could have convenienently moved this initialization to.

Does this make sense? If you don't like the proposed design then please give clear instructions what would be your preferred solution.

@egmontkob egmontkob merged commit e95a615 into MidnightCommander:master Nov 29, 2025
12 checks passed
@egmontkob egmontkob deleted the 4915_help_title_color branch November 29, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tty Interaction with the terminal, screen libraries prio: medium Has the potential to affect progress

Development

Successfully merging this pull request may close these issues.

master: Help's title color broken

2 participants