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

ncurses color fixes #1482

Merged
merged 2 commits into from
Mar 31, 2023
Merged

ncurses color fixes #1482

merged 2 commits into from
Mar 31, 2023

Conversation

bi4k8
Copy link
Collaborator

@bi4k8 bi4k8 commented Mar 31, 2023

This fixes a couple bugs with ncurses display backend.

The first is that when both ncurses and a graphical backend are enabled at the same time, they each cause one "special" to be emitted for ${color} objects, causing colors to be visually "doubled", e.g. lasting two lines of text instead of one. Instead, only emit a single special in the condition that ncurses or a graphical backend is enabled.

The second is that d51bf68 mistakenly assumed that it was valid to call init_pair with a first argument of any ncurses color ID. In fact, the first argument of init_pair is a pair ID, and pair ID 0 is reserved; this contrasts with 0 as a color ID, which is black. To fix using black, use pair IDs offset by one from the corresponding color ID.

Checklist

  • I have described the changes
  • I have linked to any relevant GitHub issues, if applicable
  • [n/a] Documentation in doc/ has been updated
  • All new code is licensed under GPLv3

bi4k8 added 2 commits March 31, 2023 02:13
we previously used the ncurses color as the id for its color pair, but this scheme needs to be shifted by one to avoid using the invalid 0 color-pair id for black (color id 0)
@netlify
Copy link

netlify bot commented Mar 31, 2023

Deploy Preview for conkyweb ready!

Name Link
🔨 Latest commit 56e1ec2
🔍 Latest deploy log https://app.netlify.com/sites/conkyweb/deploys/64264977d7362900080c98b7
😎 Deploy Preview https://deploy-preview-1482--conkyweb.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the sources PR modifies project sources label Mar 31, 2023
@brndnmtthws brndnmtthws added the bug Bug report or bug fix PR label Mar 31, 2023
@brndnmtthws brndnmtthws merged commit 3b1c9a7 into brndnmtthws:main Mar 31, 2023
@bi4k8 bi4k8 deleted the ncurses-color-fixes branch March 31, 2023 18:25
simotek pushed a commit to simotek/conky that referenced this pull request Apr 5, 2023
* specials: avoid duplicating color specials when both ncurses and a graphical output are enabled

* ncurses: fix black

we previously used the ncurses color as the id for its color pair, but this scheme needs to be shifted by one to avoid using the invalid 0 color-pair id for black (color id 0)

---------

Co-authored-by: bi4k8 <bi4k8@github>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or bug fix PR sources PR modifies project sources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants