Replies: 3 comments 3 replies
-
hey there! great question. i think i actually have something of a (very high level) document on this...let me look. Yeah, here's the doc: https://github.com/dankamongmen/notcurses/blob/master/doc/CURSES.md. Now let me look at your questions... |
Beta Was this translation helpful? Give feedback.
-
ok, so you almost never need work with all the stuff about merging colors etc. you describe above is something you very much want to leave to Notcurses. overlapping texts ought be difference check chapter 8 in the book:
so all your reading-back-and-setting should be dropped. write to planes using the style you want. render the pile. it will look like you want it to, based on the ordering of the does that make sense? |
Beta Was this translation helpful? Give feedback.
-
now looking at lnav, it looks like it is not a TUI per se? does it use the alternate screen, or at least disrupt what was there before? or does it only scroll along like e.g. |
Beta Was this translation helpful? Give feedback.
-
I'm the author of lnav and I'm a bit tired of working around ncurses limitations and looking for something to replace it. I've started the conversion to notcurses, but I would like some advice on applying styling to text. lnav currently works by building up an "attributed line" data structure that contains the text to put on the screen and a collection of metadata for spans of that text. The metadata can include visual stuff, like colors and styles, along with other stuff, like the file the log line came from.
Now, when rendering an attributed line to the ncurses API:
waddnstr()
cchar_t
usingmvwin_wchnstr()
cchar_t
s(an example of overlap is when there is a background color that applies to part of a line and inside of that section a foreground color change)
mvwadd_wchnstr()
to write back thecchar_t
sI arrived at this method because I ran into various issues trying to change the attributes as I went, using something like
wattr_set()
.Looking through the notcurses API, it looks like I can sorta keep this method by writing the string and then operating on the
nccell
s. However, it looks like I can only operate on a single cell at a time, I can't read/write an array of cells. Is that right? Or, is there a better way I should be structuring things.Beta Was this translation helpful? Give feedback.
All reactions