You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Effect::Italic does not apply when using the ncurses backend. Switching to crossterm and the effect is applied. This occurs using the with_effect() method when implementing View.
To reproduce:
use cursive::theme::Effect;use cursive::view::{Resizable,View};use cursive::Cursive;fnmain(){letmut siv = cursive::default();
siv.add_global_callback('q',Cursive::quit);// Simple view with Bold and Italic effects.
siv.add_layer(MyView::new().fixed_size((40,4)));
siv.run();}structMyView{}implMyView{fnnew() -> Self{Self{}}}implViewforMyView{fndraw(&self,printer:&cursive::Printer){
printer.with_effect(Effect::Bold, |printer| {
printer.print((0,0),"Hello, World! - Bold")});
printer.with_effect(Effect::Italic, |printer| {
printer.print((0,1),"Hello, World! - Italic")});
printer.print((0,3),"Press q to quit the application")}}
with Cargo.toml dependencies set as: cursive = { version = "0.20", features = ["ncurses-backend"] } (to reproduce the bug)
or cursive = { version = "0.20", features = ["crossterm-backend"] } (the expected behaviour)
(on macOS Monterey 12.4)
I'm not sure if this is a bug with cursive or a limitation of ncurses?
Thanks again!
The text was updated successfully, but these errors were encountered:
Indeed, I can reproduce the issue on macOS.
On linux though, italic is properly rendered.
So I suspect the issue is in the ncurses implementation on macOS. We're using ncurses::A_ITALIC, which should abstract over the actual terminal (this is the main point of ncurses), but there can always be issues there.
(We could try a C ncurses example to see if the problem is with ncurses itself or the rust wrapper.)
Unfortunately I'm not sure there's much we could do here, and using a different backend as you did is probably the best solution. You may want to also use the buffered backend to improve performance (I'm still working on integrating that in cursive itself).
I ran a C ncurses example but got a compile error when setting A_ITALIC. It turns out the ncurses installed on mac is really old and doesn't include this attribute. I thought I was up-to-date with my ncurses package but brew info ncurses yields the caveat:
ncurses is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have ncurses first in your PATH, run:
echo 'export PATH="/usr/local/opt/ncurses/bin:$PATH"' >> ~/.zshrc
For compilers to find ncurses you may need to set:
export LDFLAGS="-L/usr/local/opt/ncurses/lib"
export CPPFLAGS="-I/usr/local/opt/ncurses/include"
For pkg-config to find ncurses you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig"
So this is a user-end issue, my bad!
Setting export PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig" resolves this issue.
Firstly, thank you for your work on Cursive!
Possible bug:
Effect::Italic
does not apply when using the ncurses backend. Switching to crossterm and the effect is applied. This occurs using thewith_effect()
method when implementingView
.To reproduce:
with Cargo.toml dependencies set as:
cursive = { version = "0.20", features = ["ncurses-backend"] }
(to reproduce the bug)or
cursive = { version = "0.20", features = ["crossterm-backend"] }
(the expected behaviour)(on macOS Monterey 12.4)
I'm not sure if this is a bug with cursive or a limitation of ncurses?
Thanks again!
The text was updated successfully, but these errors were encountered: