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

fix(backend): add feature flag for underline-color #570

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

joshka
Copy link
Member

@joshka joshka commented Oct 18, 2023

Windows 7 doesn't support the underline color attribute, so we need to
make it optional. This commit adds a feature flag for the underline
color attribute - it is enabled by default, but can be disabled by
passing --no-default-features to cargo.

We could specically check for Windows 7 and disable the feature flag
automatically, but I think it's better for this check to be done by the
crossterm crate, since it's the one that actually knows about the
underlying terminal.

To disable the feature flag in an application that supports Windows 7,
add the following to your Cargo.toml:

ratatui = { version = "0.24.0", default-features = false, features = ["crossterm"] }

Fixes #555

Windows 7 doesn't support the underline color attribute, so we need to
make it optional. This commit adds a feature flag for the underline
color attribute - it is enabled by default, but can be disabled by
passing `--no-default-features` to cargo.

We could specically check for Windows 7 and disable the feature flag
automatically, but I think it's better for this check to be done by the
crossterm crate, since it's the one that actually knows about the
underlying terminal.

To disable the feature flag in an application that supports Windows 7,
add the following to your Cargo.toml:

```toml
ratatui = { version = "0.24.0", default-features = false, features = ["crossterm"] }
```

Fixes #555
@joshka
Copy link
Member Author

joshka commented Oct 18, 2023

Ping @rigelminer

To test this in your application, would you mind adding this PR as a patch override in your cargo.toml?

[patch.crates-io]
ratatui = { git = "https://github.com/ratatui-org/ratatui.git", branch = "underline-color-feature" }

Note that if you're using the non-alpha version of ratatui there may be a few other unreleased breaking changes. See https://github.com/ratatui-org/ratatui/blob/main/BREAKING-CHANGES.md for more details.

@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Merging #570 (42209d7) into main (3a57e76) will increase coverage by 0.05%.
The diff coverage is 61.11%.

@@            Coverage Diff             @@
##             main     #570      +/-   ##
==========================================
+ Coverage   89.51%   89.56%   +0.05%     
==========================================
  Files          41       41              
  Lines       11557    11570      +13     
==========================================
+ Hits        10345    10363      +18     
+ Misses       1212     1207       -5     
Files Coverage Δ
src/buffer.rs 96.82% <100.00%> (+0.10%) ⬆️
src/style.rs 92.23% <100.00%> (-0.10%) ⬇️
src/widgets/gauge.rs 92.42% <100.00%> (ø)
src/backend/crossterm.rs 0.00% <0.00%> (ø)

@rigelminer
Copy link

@joshka Thanks for the quick fix! I just tested it and can confirm the patch fixes the issue.

@joshka joshka merged commit 8d507c4 into main Oct 18, 2023
@joshka joshka deleted the underline-color-feature branch October 18, 2023 20:52
IlyaSelivanov pushed a commit to IlyaSelivanov/ratatui that referenced this pull request Oct 19, 2023
Windows 7 doesn't support the underline color attribute, so we need to
make it optional. This commit adds a feature flag for the underline
color attribute - it is enabled by default, but can be disabled by
passing `--no-default-features` to cargo.

We could specically check for Windows 7 and disable the feature flag
automatically, but I think it's better for this check to be done by the
crossterm crate, since it's the one that actually knows about the
underlying terminal.

To disable the feature flag in an application that supports Windows 7,
add the following to your Cargo.toml:

```toml
ratatui = { version = "0.24.0", default-features = false, features = ["crossterm"] }
```

Fixes ratatui#555
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows 7, crossterm, SetUnderlineColor error
3 participants