[ cc to notcurses@ added ]
José Luis Cruz left as an exercise for the reader:
> 1) I see the only option to load a character directly to a cell on its
> creation is limited to 7 bits.
>
> Wouldn't be possible to provide some way to initialize a cell with an
> 8bit char, (or even 4 byte char) without having to give a plane for
> its egcpool?
there are no eight-bit chars in utf-8. any leading byte with a 1
in its MSB is either 2, 3, or 4 bytes. also, whether char is
unsigned or signed is implementation-defined in C, so you can't
safely encode more than CHAR_BITS (guaranteed to be at least 8)
minus one bits into a char.
hrmmm. there are a lot of invalid forms once you move past the
seven bits shared with ASCII-1968. we can just call that a user
error, though, and let them reap the rewards.
i suppose that a CELL_EGC_INITIALIZER accepting a u_int32_t (as
enforced by bare assignment rules, not typing, since it's a
macro) is reasonable enough. yeah, why don't you file a bug on
this? we can probably add it before 2.1.0.
> In Rust there's this 4byte utf-8 encoded char type that would be
> perfect for loading the cell with. Right now the only way is to use
> cell_load on an existing cell, providing an plane that wont be needed.
yep, i think it's a good idea.
> 2) Would it be possible to have a function like ncplane_putc_yx with
> the difference only advances the cursor one column? or nothing at all?
> for manually managing that part.
i'm not sure i understand. you want one that's capped at a
single column? but prints to a destination of arbitrary columns?
just making sure i understand. what exactly is the goal here?
> 3) What would be the equivalent of ncdirect_clear in full mode?
> calling plane_erase for each rendered plane?
you want to clear the actual rendered screen? i'd do:
n = ncplane_dup(notcurses_stdplane(nc));
ncplane_move_top(n);
ncplane_set_base(n, " ", 0, 0);
notcurses_render(nc);
or alternatively:
that puts a plane having the same size as the visual area
(guaranteed by properties of the standard plane, which we
duplicated) at the top of the pile, with all cells set to opaque
default color spaces, which is then rendered. this new plane
obstructs everything. remove it and get everything back. it is
worth noting that one ought supply a resizecb here to keep the
screen cleared despite treacherous geometry changes.
if you really just want to empty every plane, yeah, iterate over
the pile with notcurses_top() or ncpile_top() (the latter of
which i apparently need to write, erp) and ncplane_below(), or
_bottom() and _above() if you feel so urged.
alternatively, make a new pile and render that pile. no resizecb
necessary in this case, nor ncplane_move_top().
> 4) ncplane erase says it resets all colors to the default color, but
> it doesn't seem to change the default mark as reported by
> ncplane_bg_default_p & ncplane_fg_default_p
that's poorly worded on my part. it resets the color of every
*cell* in the plane's framebuffer. the plane's active attributes
are unchanged. i will amend this comment, thanks.
> 5) This is not very important, but I'm curious why you didn't call a
> cell nccell? Is it because its name starts with the letter `c`? I'm
> actually using the Nc prefix for each notcurses type alias in the Rust
> bindings, for the sake of consistency (except for the Notcurses
> object).
The Earth quakes and the heavens rattle; the beasts of nature
flock together and the nations of men flock apart; volcanoes
usher up heat while elsewhere water becomes ice and melts; and
then on other days it just rains. Indeed do many things come to
pass.
`cell` was, like, the first structure defined -- i think before
`struct notcurses` even -- and i had to take care of all those
users of 0.4.0 or whatever.
by the time i realized there were no such users but myself,
there were real users.
when i am king, `cell` will be first against the wall. it
authentically burns me up inside.
> hacking on :)
YASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSs
https://www.youtube.com/watch?v=z2unV6W8D1s
--
nick black -=-
https://www.nick-black.com
to make an apple pie from scratch,
you need first invent a universe.