mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
stylemasks ought always be uint16_t
This commit is contained in:
parent
91420af5ce
commit
d29813457b
21
USAGE.md
21
USAGE.md
@ -1131,7 +1131,7 @@ int ncplane_set_base_cell(struct ncplane* n, const nccell* c);
|
||||
// anywhere that the ncplane's gcluster is 0. Note that the base cell is not
|
||||
// affected by ncplane_erase(). 'egc' must be an extended grapheme cluster.
|
||||
int ncplane_set_base(struct ncplane* n, const char* egc,
|
||||
uint32_t stylemask, uint64_t channels);
|
||||
uint16_t stylemask, uint64_t channels);
|
||||
|
||||
// Extract the ncplane's base cell into 'c'. The reference is invalidated if
|
||||
// 'ncp' is destroyed.
|
||||
@ -1584,7 +1584,7 @@ ncplane_perimeter(struct ncplane* n, const nccell* ul, const nccell* ur,
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
ncplane_rounded_box(struct ncplane* n, uint16_t attr, uint64_t channels,
|
||||
int ystop, int xstop, unsigned ctlword){
|
||||
int ret = 0;
|
||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
||||
@ -1600,7 +1600,7 @@ ncplane_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_rounded_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
ncplane_rounded_box_sized(struct ncplane* n, uint16_t attr, uint64_t channels,
|
||||
int ylen, int xlen, unsigned ctlword){
|
||||
int y, x;
|
||||
ncplane_cursor_yx(n, &y, &x);
|
||||
@ -1609,7 +1609,7 @@ ncplane_rounded_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
ncplane_double_box(struct ncplane* n, uint16_t attr, uint64_t channels,
|
||||
int ystop, int xstop, unsigned ctlword){
|
||||
int ret = 0;
|
||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
||||
@ -1625,7 +1625,7 @@ ncplane_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_double_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
ncplane_double_box_sized(struct ncplane* n, uint16_t attr, uint64_t channels,
|
||||
int ylen, int xlen, unsigned ctlword){
|
||||
int y, x;
|
||||
ncplane_cursor_yx(n, &y, &x);
|
||||
@ -2038,7 +2038,7 @@ int nccell_load(struct ncplane* n, nccell* c, const char* gcluster);
|
||||
// nccell_load(), plus blast the styling with 'attr' and 'channels'.
|
||||
static inline int
|
||||
nccell_prime(struct ncplane* n, nccell* c, const char* gcluster,
|
||||
uint32_t stylemask, uint64_t channels){
|
||||
uint16_t stylemask, uint64_t channels){
|
||||
c->stylemask = stylemask;
|
||||
c->channels = channels;
|
||||
int ret = nccell_load(n, c, gcluster);
|
||||
@ -2152,7 +2152,7 @@ nccellcmp(const struct ncplane* n1, const nccell* RESTRICT c1,
|
||||
// have loaded before the error are nccell_release()d. There must be at least
|
||||
// six EGCs in gcluster.
|
||||
static inline int
|
||||
nccells_load_box(struct ncplane* n, uint32_t style, uint64_t channels,
|
||||
nccells_load_box(struct ncplane* n, uint16_t style, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll, nccell* lr,
|
||||
nccell* hl, nccell* vl, const char* gclusters){
|
||||
int ulen;
|
||||
@ -2179,13 +2179,13 @@ nccells_load_box(struct ncplane* n, uint32_t style, uint64_t channels,
|
||||
|
||||
|
||||
static inline int
|
||||
nccells_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
nccells_rounded_box(struct ncplane* n, uint16_t attr, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
|
||||
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "╭╮╰╯─│");
|
||||
}
|
||||
|
||||
static inline int
|
||||
nccells_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
nccells_double_box(struct ncplane* n, uint16_t attr, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
|
||||
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "╔╗╚╝═║");
|
||||
}
|
||||
@ -3525,7 +3525,8 @@ a QR code for arbitrary data.
|
||||
// returned. Otherwise, the QR code "version" (size) is returned. The QR code
|
||||
// is (version * 4 + 17) columns wide, and ⌈version * 4 + 17⌉ rows tall (the
|
||||
// properly-scaled values are written back to '*ymax' and '*xmax').
|
||||
int ncplane_qrcode(struct ncplane* n, int* ymax, int* xmax, const void* data, size_t len);
|
||||
int ncplane_qrcode(struct ncplane* n, unsigned* ymax, unsigned* xmax,
|
||||
const void* data, size_t len);
|
||||
```
|
||||
|
||||
### Multimedia
|
||||
|
@ -37,25 +37,25 @@ notcurses_lines - operations on lines and boxes
|
||||
|
||||
**static inline int ncplane_perimeter(struct ncplane* ***n***, const nccell* ***ul***, const nccell* ***ur***, const nccell* ***ll***, const nccell* ***lr***, const nccell* ***hline***, const nccell* ***vline***, unsigned ***ctlword***)**
|
||||
|
||||
**static inline int nccells_load_box(struct ncplane* ***n***, uint32_t ***styles***, uint64_t ***channels***, nccell* ***ul***, nccell* ***ur***, nccell* ***ll***, nccell* ***lr***, nccell* ***hl***, nccell* ***vl***, const char* ***gclusters***);**
|
||||
**static inline int nccells_load_box(struct ncplane* ***n***, uint16_t ***styles***, uint64_t ***channels***, nccell* ***ul***, nccell* ***ur***, nccell* ***ll***, nccell* ***lr***, nccell* ***hl***, nccell* ***vl***, const char* ***gclusters***);**
|
||||
|
||||
**static inline int nccells_rounded_box(struct ncplane* ***n***, uint32_t ***styles***, uint64_t ***channels***, nccell* ***ul***, nccell* ***ur***, nccell* ***ll***, nccell* ***lr***, nccell* ***hl***, nccell* ***vl***);**
|
||||
**static inline int nccells_rounded_box(struct ncplane* ***n***, uint16_t ***styles***, uint64_t ***channels***, nccell* ***ul***, nccell* ***ur***, nccell* ***ll***, nccell* ***lr***, nccell* ***hl***, nccell* ***vl***);**
|
||||
|
||||
**static inline int ncplane_rounded_box(struct ncplane* ***n***, uint32_t ***styles***, uint64_t ***channels***, int ***ystop***, int ***xstop***, unsigned ***ctlword***);**
|
||||
**static inline int ncplane_rounded_box(struct ncplane* ***n***, uint16_t ***styles***, uint64_t ***channels***, int ***ystop***, int ***xstop***, unsigned ***ctlword***);**
|
||||
|
||||
**static inline int ncplane_rounded_box_sized(struct ncplane* ***n***, uint32_t ***styles***, uint64_t ***channels***, int ***ylen***, int ***xlen***, unsigned ***ctlword***);**
|
||||
**static inline int ncplane_rounded_box_sized(struct ncplane* ***n***, uint16_t ***styles***, uint64_t ***channels***, int ***ylen***, int ***xlen***, unsigned ***ctlword***);**
|
||||
|
||||
**static inline int nccells_double_box(struct ncplane* ***n***, uint32_t ***styles***, uint64_t ***channels***, nccell* ***ul***, nccell* ***ur***, nccell* ***ll***, nccell* ***lr***, nccell* ***hl***, nccell* ***vl***);**
|
||||
**static inline int nccells_double_box(struct ncplane* ***n***, uint16_t ***styles***, uint64_t ***channels***, nccell* ***ul***, nccell* ***ur***, nccell* ***ll***, nccell* ***lr***, nccell* ***hl***, nccell* ***vl***);**
|
||||
|
||||
**static inline int ncplane_double_box(struct ncplane* ***n***, uint32_t ***styles***, uint64_t ***channels***, int ***ystop***, int ***xstop***, unsigned ***ctlword***);**
|
||||
**static inline int ncplane_double_box(struct ncplane* ***n***, uint16_t ***styles***, uint64_t ***channels***, int ***ystop***, int ***xstop***, unsigned ***ctlword***);**
|
||||
|
||||
**static inline int ncplane_double_box_sized(struct ncplane* ***n***, uint32_t ***styles***, uint64_t ***channels***, int ***ylen***, int ***xlen***, unsigned ***ctlword***);**
|
||||
**static inline int ncplane_double_box_sized(struct ncplane* ***n***, uint16_t ***styles***, uint64_t ***channels***, int ***ylen***, int ***xlen***, unsigned ***ctlword***);**
|
||||
|
||||
**int ncplane_polyfill_yx(struct ncplane* ***n***, unsigned ***y***, unsigned ***x***, const nccell* ***c***);**
|
||||
|
||||
**int ncplane_gradient(struct ncplane* ***n***, int ***y***, int ***x***, unsigned ***ylen***, unsigned ***xlen***, const char* ***egc***, uint16_t ***stylemask***, uint64_t ***ul***, uint64_t ***ur***, uint64_t ***ll***, uint64_t ***lr***);**
|
||||
|
||||
**int ncplane_highgradient2x1(struct ncplane* ***n***, int ***y***, int ***x***, unsigned ***ylen***, unsigned ***xlen***, uint16_t ***ul***, uint32_t ***ur***, uint32_t ***ll***, uint32_t ***lr***);**
|
||||
**int ncplane_highgradient2x1(struct ncplane* ***n***, int ***y***, int ***x***, unsigned ***ylen***, unsigned ***xlen***, uint32_t ***ul***, uint32_t ***ur***, uint32_t ***ll***, uint32_t ***lr***);**
|
||||
|
||||
**int ncplane_format(struct ncplane* ***n***, int ***y***, int ***x***, unsigned ***ylen***, unsigned ***xlen***, uint16_t ***stylemask***);**
|
||||
|
||||
|
@ -91,7 +91,7 @@ typedef struct ncplane_options {
|
||||
|
||||
**int ncplane_set_base_cell(struct ncplane* ***ncp***, const nccell* ***c***);**
|
||||
|
||||
**int ncplane_set_base(struct ncplane* ***ncp***, const char* ***egc***, uint32_t ***stylemask***, uint64_t ***channels***);**
|
||||
**int ncplane_set_base(struct ncplane* ***ncp***, const char* ***egc***, uint16_t ***stylemask***, uint64_t ***channels***);**
|
||||
|
||||
**int ncplane_base(struct ncplane* ***ncp***, nccell* ***c***);**
|
||||
|
||||
|
@ -119,7 +119,7 @@ typedef struct ncvgeom {
|
||||
|
||||
**ncblitter_e ncvisual_media_defblitter(const struct notcurses ***nc***, ncscale_e ***scaling***);**
|
||||
|
||||
**int ncplane_qrcode(struct ncplane* ***n***, int* ***ymax***, int* ***xmax***, const void* ***data***, size_t ***len***)**
|
||||
**int ncplane_qrcode(struct ncplane* ***n***, unsigned* ***ymax***, unsigned* ***xmax***, const void* ***data***, size_t ***len***)**
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
|
@ -1215,7 +1215,7 @@ namespace ncpp
|
||||
return error_guard_cond<bool, bool> (ret, ret);
|
||||
}
|
||||
|
||||
int qrcode (int* ymax, int* xmax, const void *data, size_t len) const NOEXCEPT_MAYBE
|
||||
int qrcode (unsigned* ymax, unsigned* xmax, const void *data, size_t len) const NOEXCEPT_MAYBE
|
||||
{
|
||||
int ret = ncplane_qrcode (plane, ymax, xmax, data, len);
|
||||
return error_guard_cond<int> (ret, ret < 0);
|
||||
|
@ -684,7 +684,7 @@ API int nccell_load(struct ncplane* n, nccell* c, const char* gcluster);
|
||||
// nccell_load(), plus blast the styling with 'attr' and 'channels'.
|
||||
static inline int
|
||||
nccell_prime(struct ncplane* n, nccell* c, const char* gcluster,
|
||||
uint32_t stylemask, uint64_t channels){
|
||||
uint16_t stylemask, uint64_t channels){
|
||||
c->stylemask = stylemask;
|
||||
c->channels = channels;
|
||||
int ret = nccell_load(n, c, gcluster);
|
||||
@ -1626,7 +1626,7 @@ API int ncplane_set_base_cell(struct ncplane* n, const nccell* c);
|
||||
// affected by ncplane_erase(). 'egc' must be an extended grapheme cluster.
|
||||
// Returns the number of bytes copied out of 'gcluster', or -1 on failure.
|
||||
API int ncplane_set_base(struct ncplane* n, const char* egc,
|
||||
uint32_t stylemask, uint64_t channels);
|
||||
uint16_t stylemask, uint64_t channels);
|
||||
|
||||
// Extract the ncplane's base nccell into 'c'. The reference is invalidated if
|
||||
// 'ncp' is destroyed.
|
||||
@ -2686,18 +2686,18 @@ nccells_load_box(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
return -1;
|
||||
}
|
||||
|
||||
API int nccells_rounded_box(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
API int nccells_rounded_box(struct ncplane* n, uint16_t styles, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll,
|
||||
nccell* lr, nccell* hl, nccell* vl);
|
||||
|
||||
static inline int
|
||||
nccells_ascii_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
nccells_ascii_box(struct ncplane* n, uint16_t attr, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
|
||||
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, NCBOXASCII);
|
||||
}
|
||||
|
||||
static inline int
|
||||
nccells_light_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
nccells_light_box(struct ncplane* n, uint16_t attr, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n))){
|
||||
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, NCBOXLIGHT);
|
||||
@ -2706,7 +2706,7 @@ nccells_light_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
}
|
||||
|
||||
static inline int
|
||||
nccells_heavy_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
nccells_heavy_box(struct ncplane* n, uint16_t attr, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n))){
|
||||
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, NCBOXHEAVY);
|
||||
@ -2715,7 +2715,7 @@ nccells_heavy_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_rounded_box(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
ncplane_rounded_box(struct ncplane* n, uint16_t styles, uint64_t channels,
|
||||
int ystop, int xstop, unsigned ctlword){
|
||||
int ret = 0;
|
||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
||||
@ -2731,7 +2731,7 @@ ncplane_rounded_box(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_perimeter_rounded(struct ncplane* n, uint32_t stylemask,
|
||||
ncplane_perimeter_rounded(struct ncplane* n, uint16_t stylemask,
|
||||
uint64_t channels, unsigned ctlword){
|
||||
if(ncplane_cursor_move_yx(n, 0, 0)){
|
||||
return -1;
|
||||
@ -2755,7 +2755,7 @@ ncplane_perimeter_rounded(struct ncplane* n, uint32_t stylemask,
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_rounded_box_sized(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
ncplane_rounded_box_sized(struct ncplane* n, uint16_t styles, uint64_t channels,
|
||||
int ylen, int xlen, unsigned ctlword){
|
||||
int y, x;
|
||||
ncplane_cursor_yx(n, &y, &x);
|
||||
@ -2763,12 +2763,12 @@ ncplane_rounded_box_sized(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
x + xlen - 1, ctlword);
|
||||
}
|
||||
|
||||
API int nccells_double_box(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
API int nccells_double_box(struct ncplane* n, uint16_t styles, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll,
|
||||
nccell* lr, nccell* hl, nccell* vl);
|
||||
|
||||
static inline int
|
||||
ncplane_double_box(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
ncplane_double_box(struct ncplane* n, uint16_t styles, uint64_t channels,
|
||||
int ystop, int xstop, unsigned ctlword){
|
||||
int ret = 0;
|
||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
||||
@ -2784,7 +2784,7 @@ ncplane_double_box(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_perimeter_double(struct ncplane* n, uint32_t stylemask,
|
||||
ncplane_perimeter_double(struct ncplane* n, uint16_t stylemask,
|
||||
uint64_t channels, unsigned ctlword){
|
||||
if(ncplane_cursor_move_yx(n, 0, 0)){
|
||||
return -1;
|
||||
@ -2808,7 +2808,7 @@ ncplane_perimeter_double(struct ncplane* n, uint32_t stylemask,
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_double_box_sized(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
ncplane_double_box_sized(struct ncplane* n, uint16_t styles, uint64_t channels,
|
||||
int ylen, int xlen, unsigned ctlword){
|
||||
int y, x;
|
||||
ncplane_cursor_yx(n, &y, &x);
|
||||
@ -4134,7 +4134,7 @@ API int ncsubproc_destroy(struct ncsubproc* n);
|
||||
// returned. Otherwise, the QR code "version" (size) is returned. The QR code
|
||||
// is (version * 4 + 17) columns wide, and ⌈version * 4 + 17⌉ rows tall (the
|
||||
// properly-scaled values are written back to '*ymax' and '*xmax').
|
||||
API int ncplane_qrcode(struct ncplane* n, int* ymax, int* xmax,
|
||||
API int ncplane_qrcode(struct ncplane* n, unsigned* ymax, unsigned* xmax,
|
||||
const void* data, size_t len)
|
||||
__attribute__ ((nonnull (1, 4)));
|
||||
|
||||
@ -4222,12 +4222,12 @@ API void ncplane_styles_off(struct ncplane* n, unsigned stylebits)
|
||||
__attribute__ ((deprecated));
|
||||
|
||||
__attribute__ ((deprecated)) API int
|
||||
cells_rounded_box(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
cells_rounded_box(struct ncplane* n, uint16_t styles, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll,
|
||||
nccell* lr, nccell* hl, nccell* vl);
|
||||
|
||||
__attribute__ ((deprecated)) API int
|
||||
cells_double_box(struct ncplane* n, uint32_t styles, uint64_t channels,
|
||||
cells_double_box(struct ncplane* n, uint16_t styles, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll,
|
||||
nccell* lr, nccell* hl, nccell* vl);
|
||||
|
||||
|
@ -159,7 +159,7 @@ draw_eagle(struct ncplane* n, const char* sprite){
|
||||
static int
|
||||
eagles(struct notcurses* nc, struct ncplane* n){
|
||||
int ret = 0;
|
||||
int truex, truey; // dimensions of true display
|
||||
unsigned truex, truey; // dimensions of true display
|
||||
notcurses_term_dim_yx(nc, &truey, &truex);
|
||||
struct timespec flapiter;
|
||||
timespec_div(&demodelay, truex / 2, &flapiter);
|
||||
|
@ -246,7 +246,7 @@ gridswitch_demo(struct notcurses* nc, struct ncplane *n){
|
||||
|
||||
// red across, blue down, green from UL to LR
|
||||
int grid_demo(struct notcurses* nc){
|
||||
int y, x;
|
||||
unsigned y, x;
|
||||
struct ncplane* n = notcurses_stdplane(nc);
|
||||
ncplane_erase(n);
|
||||
nccell ul, uc, ur;
|
||||
|
@ -63,7 +63,7 @@ generate_next_color(unsigned *total, unsigned *r, unsigned *g, unsigned *b,
|
||||
int highcontrast_demo(struct notcurses* nc){
|
||||
const int STEP = 16;
|
||||
int ret = -1;
|
||||
int dimy, dimx;
|
||||
unsigned dimy, dimx;
|
||||
struct ncplane* n = notcurses_stddim_yx(nc, &dimy, &dimx);
|
||||
int totcells = (dimy - 1) * dimx;
|
||||
if(totcells <= 1){
|
||||
|
@ -104,7 +104,8 @@ orcashow(struct notcurses* nc, unsigned dimy, unsigned dimx){
|
||||
|
||||
static int
|
||||
orcaride(struct notcurses* nc, struct ncplane* on, int iterations){
|
||||
int odimy, odimx, oy, ox, dimx;
|
||||
unsigned odimy, odimx, dimx;
|
||||
int oy, ox;
|
||||
ncplane_dim_yx(notcurses_stdplane(nc), NULL, &dimx);
|
||||
ncplane_yx(on, &oy, &ox);
|
||||
ncplane_dim_yx(on, &odimy, &odimx);
|
||||
|
@ -68,7 +68,7 @@ rotate_visual(struct notcurses* nc, struct ncplane* n, int dy, int dx){
|
||||
return -1;
|
||||
}
|
||||
ncplane_destroy(n);
|
||||
int dimy, dimx;
|
||||
unsigned dimy, dimx;
|
||||
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
|
||||
const int ROTATIONS = 32;
|
||||
timespec_div(&demodelay, ROTATIONS / 2, &scaled);
|
||||
@ -178,7 +178,7 @@ int normal_demo(struct notcurses* nc){
|
||||
for(int off = 0 ; off < dy * dx ; ++off){
|
||||
rgba[off] = 0xff000000;
|
||||
}
|
||||
int y;
|
||||
unsigned y;
|
||||
if(dy / geom.scaley % 2){
|
||||
y = dy / geom.scaley + 1;
|
||||
for(int x = 0 ; x < dx ; ++x){
|
||||
|
@ -52,7 +52,7 @@ videothread(void* vnc){
|
||||
if(ncv == NULL){
|
||||
return NULL;
|
||||
}
|
||||
int rows, cols;
|
||||
unsigned rows, cols;
|
||||
struct ncplane* ncp = notcurses_stddim_yx(nc, &rows, &cols);
|
||||
struct ncvisual_options ovopts = {
|
||||
.scaling = NCSCALE_STRETCH,
|
||||
|
@ -21,7 +21,7 @@ int qrcode_demo(struct notcurses* nc){
|
||||
done += sizeof(r);
|
||||
}
|
||||
ncplane_home(n);
|
||||
int y = dimy, x = dimx;
|
||||
unsigned y = dimy, x = dimx;
|
||||
ncplane_home(n);
|
||||
int qlen = ncplane_qrcode(n, &y, &x, data, len);
|
||||
if(qlen > 0){ // FIXME can fail due to being too large for display; distinguish this case
|
||||
|
@ -26,7 +26,7 @@ grow_rgb8(uint32_t* rgb){
|
||||
|
||||
static struct ncplane*
|
||||
legend(struct notcurses* nc, const char* msg){
|
||||
int dimx, dimy;
|
||||
unsigned dimx, dimy;
|
||||
notcurses_term_dim_yx(nc, &dimy, &dimx);
|
||||
ncplane_options nopts = {
|
||||
.rows = 3,
|
||||
@ -62,10 +62,10 @@ legend(struct notcurses* nc, const char* msg){
|
||||
static int
|
||||
slideitslideit(struct notcurses* nc, struct ncplane* n, uint64_t deadline,
|
||||
int* vely, int* velx){
|
||||
int dimy, dimx;
|
||||
int yoff, xoff;
|
||||
int ny, nx;
|
||||
unsigned dimy, dimx;
|
||||
notcurses_term_dim_yx(nc, &dimy, &dimx);
|
||||
unsigned ny, nx;
|
||||
ncplane_dim_yx(n, &ny, &nx);
|
||||
ncplane_yx(n, &yoff, &xoff);
|
||||
struct timespec iterdelay;
|
||||
@ -78,14 +78,14 @@ slideitslideit(struct notcurses* nc, struct ncplane* n, uint64_t deadline,
|
||||
if(xoff <= 1){
|
||||
xoff = 1;
|
||||
*velx = -*velx;
|
||||
}else if(xoff >= dimx - nx){
|
||||
}else if((unsigned)xoff >= dimx - nx){
|
||||
xoff = dimx - nx - 1;
|
||||
*velx = -*velx;
|
||||
}
|
||||
if(yoff <= 2){
|
||||
yoff = 2;
|
||||
*vely = -*vely;
|
||||
}else if(yoff >= dimy - ny){
|
||||
}else if((unsigned)yoff >= dimy - ny){
|
||||
yoff = dimy - ny - 1;
|
||||
*vely = -*vely;
|
||||
}
|
||||
@ -99,7 +99,7 @@ slideitslideit(struct notcurses* nc, struct ncplane* n, uint64_t deadline,
|
||||
// run panels atop the display in an exploration of transparency
|
||||
static int
|
||||
slidepanel(struct notcurses* nc, struct ncplane* stdn){
|
||||
int dimy, dimx;
|
||||
unsigned dimy, dimx;
|
||||
notcurses_term_dim_yx(nc, &dimy, &dimx);
|
||||
int ny = dimy / 4;
|
||||
int nx = dimx / 3;
|
||||
@ -276,13 +276,13 @@ slidepanel(struct notcurses* nc, struct ncplane* stdn){
|
||||
// have a great many colors, that they progress reasonably through the space,
|
||||
// and that we can write to every coordinate.
|
||||
int trans_demo(struct notcurses* nc){
|
||||
int maxx, maxy;
|
||||
unsigned maxx, maxy;
|
||||
struct ncplane* n = notcurses_stddim_yx(nc, &maxy, &maxx);
|
||||
ncplane_set_fg_rgb8(n, 255, 255, 255);
|
||||
uint64_t channels = 0;
|
||||
ncchannels_set_fg_rgb8(&channels, 0, 128, 128);
|
||||
ncchannels_set_bg_rgb8(&channels, 90, 0, 90);
|
||||
int y = 1, x = 0;
|
||||
unsigned y = 1, x = 0;
|
||||
ncplane_cursor_move_yx(n, y, x);
|
||||
if(ncplane_rounded_box_sized(n, 0, channels, maxy - 1, maxx, 0)){
|
||||
return -1;
|
||||
|
@ -536,17 +536,17 @@ int ncplane_rotate_ccw(ncplane* n){
|
||||
#define QR_BASE_SIZE 17
|
||||
#define PER_QR_VERSION 4
|
||||
|
||||
static inline int
|
||||
qrcode_rows(int version){
|
||||
static inline unsigned
|
||||
qrcode_rows(unsigned version){
|
||||
return QR_BASE_SIZE + (version * PER_QR_VERSION);
|
||||
}
|
||||
|
||||
static inline int
|
||||
qrcode_cols(int version){
|
||||
static inline unsigned
|
||||
qrcode_cols(unsigned version){
|
||||
return QR_BASE_SIZE + (version * PER_QR_VERSION);
|
||||
}
|
||||
|
||||
int ncplane_qrcode(ncplane* n, int* ymax, int* xmax, const void* data, size_t len){
|
||||
int ncplane_qrcode(ncplane* n, unsigned* ymax, unsigned* xmax, const void* data, size_t len){
|
||||
const ncblitter_e blitfxn = NCBLIT_2x1;
|
||||
const int MAX_QR_VERSION = 40; // QR library only supports up to 40
|
||||
if(*ymax <= 0 || *xmax <= 0){
|
||||
|
@ -74,7 +74,7 @@ struct ncvisual_details;
|
||||
typedef struct ncplane {
|
||||
nccell* fb; // "framebuffer" of character cells
|
||||
int logrow; // logical top row, starts at 0, add one for each scroll
|
||||
int x, y; // current cursor location within this plane
|
||||
unsigned x, y; // current cursor location within this plane
|
||||
// ncplane_yx() etc. use coordinates relative to the plane to which this
|
||||
// plane is bound, but absx/absy are always relative to the terminal origin.
|
||||
// they must thus be translated by any function which moves a parent plane.
|
||||
|
@ -184,9 +184,6 @@ cursor_invalid_p(const ncplane* n){
|
||||
if(n->y >= n->leny || n->x >= n->lenx){
|
||||
return true;
|
||||
}
|
||||
if(n->y < 0 || n->x < 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -195,33 +192,46 @@ char* ncplane_at_cursor(ncplane* n, uint16_t* stylemask, uint64_t* channels){
|
||||
}
|
||||
|
||||
char* ncplane_at_yx(const ncplane* n, int y, int x, uint16_t* stylemask, uint64_t* channels){
|
||||
if(y < n->leny && x < n->lenx){
|
||||
if(y >= 0 && x >= 0){
|
||||
const nccell* yx = &n->fb[nfbcellidx(n, y, x)];
|
||||
// if we're the right side of a wide glyph, we return the main glyph
|
||||
if(nccell_wide_right_p(yx)){
|
||||
return ncplane_at_yx(n, y, x - 1, stylemask, channels);
|
||||
}
|
||||
char* ret = nccell_extract(n, yx, stylemask, channels);
|
||||
if(ret == NULL){
|
||||
return NULL;
|
||||
}
|
||||
if(y < 0){
|
||||
if(y != -1){
|
||||
logerror("invalid y: %d\n", y);
|
||||
return NULL;
|
||||
}
|
||||
y = n->y;
|
||||
}
|
||||
if(x < 0){
|
||||
if(x != -1){
|
||||
logerror("invalid x: %d\n", x);
|
||||
return NULL;
|
||||
}
|
||||
x = n->x;
|
||||
}
|
||||
if((unsigned)y >= n->leny || (unsigned)x >= n->lenx){
|
||||
logerror("invalid coordinates: %d/%d\n", y, x);
|
||||
return NULL;
|
||||
}
|
||||
const nccell* yx = &n->fb[nfbcellidx(n, y, x)];
|
||||
// if we're the right side of a wide glyph, we return the main glyph
|
||||
if(nccell_wide_right_p(yx)){
|
||||
return ncplane_at_yx(n, y, x - 1, stylemask, channels);
|
||||
}
|
||||
char* ret = nccell_extract(n, yx, stylemask, channels);
|
||||
if(ret == NULL){
|
||||
return NULL;
|
||||
}
|
||||
//fprintf(stderr, "GOT [%s]\n", ret);
|
||||
if(strcmp(ret, "") == 0){
|
||||
free(ret);
|
||||
ret = nccell_strdup(n, &n->basecell);
|
||||
if(ret == NULL){
|
||||
return NULL;
|
||||
}
|
||||
if(stylemask){
|
||||
*stylemask = n->basecell.stylemask;
|
||||
}
|
||||
}
|
||||
// FIXME load basecell channels if appropriate
|
||||
return ret;
|
||||
if(strcmp(ret, "") == 0){
|
||||
free(ret);
|
||||
ret = nccell_strdup(n, &n->basecell);
|
||||
if(ret == NULL){
|
||||
return NULL;
|
||||
}
|
||||
if(stylemask){
|
||||
*stylemask = n->basecell.stylemask;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
// FIXME load basecell channels if appropriate
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ncplane_at_cursor_cell(ncplane* n, nccell* c){
|
||||
@ -229,16 +239,30 @@ int ncplane_at_cursor_cell(ncplane* n, nccell* c){
|
||||
}
|
||||
|
||||
int ncplane_at_yx_cell(ncplane* n, int y, int x, nccell* c){
|
||||
if(y < n->leny && x < n->lenx){
|
||||
if(y >= 0 && x >= 0){
|
||||
nccell* targ = ncplane_cell_ref_yx(n, y, x);
|
||||
if(nccell_duplicate(n, c, targ) == 0){
|
||||
// FIXME take base cell into account where necessary!
|
||||
return strlen(nccell_extended_gcluster(n, targ));
|
||||
}
|
||||
if(y < 0){
|
||||
if(y != -1){
|
||||
logerror("invalid y: %d\n", y);
|
||||
return -1;
|
||||
}
|
||||
y = n->y;
|
||||
}
|
||||
return -1;
|
||||
if(x < 0){
|
||||
if(x != -1){
|
||||
logerror("invalid x: %d\n", x);
|
||||
return -1;
|
||||
}
|
||||
x = n->x;
|
||||
}
|
||||
if((unsigned)y >= n->leny || (unsigned)x >= n->lenx){
|
||||
logerror("invalid coordinates: %d/%d\n", y, x);
|
||||
return -1;
|
||||
}
|
||||
nccell* targ = ncplane_cell_ref_yx(n, y, x);
|
||||
if(nccell_duplicate(n, c, targ)){
|
||||
return -1;
|
||||
}
|
||||
// FIXME take base cell into account where necessary!
|
||||
return strlen(nccell_extended_gcluster(n, targ));
|
||||
}
|
||||
|
||||
void ncplane_dim_yx(const ncplane* n, unsigned* rows, unsigned* cols){
|
||||
@ -607,7 +631,7 @@ int ncplane_cursor_move_yx(ncplane* n, int y, int x){
|
||||
return -1;
|
||||
}
|
||||
}else if((unsigned)x >= n->lenx){
|
||||
logerror("Target x %d >= length %u\n", x, n->lenx);
|
||||
logerror("target x %d >= width %u\n", x, n->lenx);
|
||||
return -1;
|
||||
}else{
|
||||
n->x = x;
|
||||
@ -617,25 +641,25 @@ int ncplane_cursor_move_yx(ncplane* n, int y, int x){
|
||||
logerror("Negative target y %d\n", y);
|
||||
return -1;
|
||||
}
|
||||
}else if(y >= n->leny){
|
||||
logerror("Target y %d >= height %u\n", y, n->leny);
|
||||
}else if((unsigned)y >= n->leny){
|
||||
logerror("target y %d >= height %u\n", y, n->leny);
|
||||
return -1;
|
||||
}else{
|
||||
n->y = y;
|
||||
}
|
||||
if(cursor_invalid_p(n)){
|
||||
logerror("Invalid cursor following move (%d/%d)\n", n->y, n->x);
|
||||
logerror("invalid cursor following move (%d/%d)\n", n->y, n->x);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ncplane_cursor_move_rel(ncplane* n, int y, int x){
|
||||
if (n->y + y == -1){
|
||||
logerror("Invalid target y -1\n");
|
||||
if((int)n->y + y == -1){
|
||||
logerror("invalid target y -1\n");
|
||||
return -1;
|
||||
}else if (n->x + x == -1){
|
||||
logerror("Invalid target x -1\n");
|
||||
}else if((int)n->x + x == -1){
|
||||
logerror("invalid target x -1\n");
|
||||
return -1;
|
||||
}else return ncplane_cursor_move_yx(n, n->y + y, n->x + x);
|
||||
}
|
||||
@ -1131,10 +1155,13 @@ notcurses* notcurses_core_init(const notcurses_options* opts, FILE* outfp){
|
||||
}
|
||||
if(ret->rstate.logendy >= 0){ // if either is set, both are
|
||||
if(!ret->suppress_banner && ret->tcache.ttyfd >= 0){
|
||||
if(locate_cursor(&ret->tcache, &ret->rstate.logendy, &ret->rstate.logendx)){
|
||||
unsigned uendy, uendx;
|
||||
if(locate_cursor(&ret->tcache, &uendy, &uendx)){
|
||||
free_plane(ret->stdplane);
|
||||
goto err;
|
||||
}
|
||||
ret->rstate.logendy = uendy;
|
||||
ret->rstate.logendx = uendx;
|
||||
}
|
||||
if(opts->flags & NCOPTION_PRESERVE_CURSOR){
|
||||
ncplane_cursor_move_yx(ret->stdplane, ret->rstate.logendy, ret->rstate.logendx);
|
||||
@ -1335,7 +1362,7 @@ int ncplane_set_base_cell(ncplane* ncp, const nccell* c){
|
||||
return nccell_duplicate(ncp, &ncp->basecell, c);
|
||||
}
|
||||
|
||||
int ncplane_set_base(ncplane* ncp, const char* egc, uint32_t stylemask, uint64_t channels){
|
||||
int ncplane_set_base(ncplane* ncp, const char* egc, uint16_t stylemask, uint64_t channels){
|
||||
return nccell_prime(ncp, &ncp->basecell, egc, stylemask, channels);
|
||||
}
|
||||
|
||||
@ -1641,7 +1668,7 @@ ncplane_put(ncplane* n, int y, int x, const char* egc, int cols,
|
||||
// line. if scrolling is enabled, move to the next line if so. if x or y are
|
||||
// specified, we must always try to print at exactly that location.
|
||||
if(x != -1){
|
||||
if(x + cols > n->lenx){
|
||||
if((unsigned)x + cols > n->lenx){
|
||||
logerror("Target x %d + %d cols [%.*s] > length %d\n", x, cols, bytes, egc, n->lenx);
|
||||
ncplane_cursor_move_yx(n, y, x); // update cursor, though
|
||||
return -1;
|
||||
@ -1725,7 +1752,7 @@ int ncplane_putegc_yx(ncplane* n, int y, int x, const char* gclust, int* sbytes)
|
||||
|
||||
int ncplane_putchar_stained(ncplane* n, char c){
|
||||
uint64_t channels = n->channels;
|
||||
uint32_t stylemask = n->stylemask;
|
||||
uint16_t stylemask = n->stylemask;
|
||||
const nccell* targ = &n->fb[nfbcellidx(n, n->y, n->x)];
|
||||
n->channels = targ->channels;
|
||||
n->stylemask = targ->stylemask;
|
||||
@ -1737,7 +1764,7 @@ int ncplane_putchar_stained(ncplane* n, char c){
|
||||
|
||||
int ncplane_putwegc_stained(ncplane* n, const wchar_t* gclust, int* sbytes){
|
||||
uint64_t channels = n->channels;
|
||||
uint32_t stylemask = n->stylemask;
|
||||
uint16_t stylemask = n->stylemask;
|
||||
const nccell* targ = &n->fb[nfbcellidx(n, n->y, n->x)];
|
||||
n->channels = targ->channels;
|
||||
n->stylemask = targ->stylemask;
|
||||
@ -1749,7 +1776,7 @@ int ncplane_putwegc_stained(ncplane* n, const wchar_t* gclust, int* sbytes){
|
||||
|
||||
int ncplane_putegc_stained(ncplane* n, const char* gclust, int* sbytes){
|
||||
uint64_t channels = n->channels;
|
||||
uint32_t stylemask = n->stylemask;
|
||||
uint16_t stylemask = n->stylemask;
|
||||
const nccell* targ = &n->fb[nfbcellidx(n, n->y, n->x)];
|
||||
n->channels = targ->channels;
|
||||
n->stylemask = targ->stylemask;
|
||||
@ -2484,8 +2511,8 @@ int ncplane_resize_marginalized(ncplane* n){
|
||||
}
|
||||
unsigned oldy, oldx;
|
||||
ncplane_dim_yx(n, &oldy, &oldx); // current dimensions of 'n'
|
||||
int keepleny = oldy > maxy ? maxy : oldy;
|
||||
int keeplenx = oldx > maxx ? maxx : oldx;
|
||||
unsigned keepleny = oldy > maxy ? maxy : oldy;
|
||||
unsigned keeplenx = oldx > maxx ? maxx : oldx;
|
||||
if(ncplane_resize_internal(n, 0, 0, keepleny, keeplenx, 0, 0, maxy, maxx)){
|
||||
return -1;
|
||||
}
|
||||
@ -2497,12 +2524,12 @@ int ncplane_resize_marginalized(ncplane* n){
|
||||
|
||||
int ncplane_resize_maximize(ncplane* n){
|
||||
const ncpile* pile = ncplane_pile(n); // FIXME should be taken against parent
|
||||
const int rows = pile->dimy;
|
||||
const int cols = pile->dimx;
|
||||
const unsigned rows = pile->dimy;
|
||||
const unsigned cols = pile->dimx;
|
||||
unsigned oldy, oldx;
|
||||
ncplane_dim_yx(n, &oldy, &oldx); // current dimensions of 'n'
|
||||
int keepleny = oldy > rows ? rows : oldy;
|
||||
int keeplenx = oldx > cols ? cols : oldx;
|
||||
unsigned keepleny = oldy > rows ? rows : oldy;
|
||||
unsigned keeplenx = oldx > cols ? cols : oldx;
|
||||
return ncplane_resize_internal(n, 0, 0, keepleny, keeplenx, 0, 0, rows, cols);
|
||||
}
|
||||
|
||||
@ -2979,7 +3006,7 @@ char* ncplane_contents(ncplane* nc, int begy, int begx, unsigned leny, unsigned
|
||||
return ret;
|
||||
}
|
||||
|
||||
int nccells_double_box(ncplane* n, uint32_t attr, uint64_t channels,
|
||||
int nccells_double_box(ncplane* n, uint16_t attr, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n))){
|
||||
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, NCBOXDOUBLE);
|
||||
@ -2987,12 +3014,12 @@ int nccells_double_box(ncplane* n, uint32_t attr, uint64_t channels,
|
||||
return nccells_ascii_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
|
||||
}
|
||||
|
||||
int cells_double_box(ncplane* n, uint32_t attr, uint64_t channels,
|
||||
int cells_double_box(ncplane* n, uint16_t attr, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
|
||||
return nccells_double_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
|
||||
}
|
||||
|
||||
int nccells_rounded_box(ncplane* n, uint32_t attr, uint64_t channels,
|
||||
int nccells_rounded_box(ncplane* n, uint16_t attr, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
|
||||
if(notcurses_canutf8(ncplane_notcurses(n))){
|
||||
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, NCBOXROUND);
|
||||
@ -3000,7 +3027,7 @@ int nccells_rounded_box(ncplane* n, uint32_t attr, uint64_t channels,
|
||||
return nccells_ascii_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
|
||||
}
|
||||
|
||||
int cells_rounded_box(ncplane* n, uint32_t attr, uint64_t channels,
|
||||
int cells_rounded_box(ncplane* n, uint16_t attr, uint64_t channels,
|
||||
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
|
||||
return nccells_rounded_box(n, attr, channels, ul, ur, ll, lr, hl, vl);
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ int ncreader_write_egc(ncreader* n, const char* egc){
|
||||
logerror("Fed illegal UTF-8 [%s]\n", egc);
|
||||
return -1;
|
||||
}
|
||||
if(n->textarea->x >= (int)n->textarea->lenx - cols){
|
||||
if(n->textarea->x >= n->textarea->lenx - cols){
|
||||
if(n->horscroll){
|
||||
if(ncplane_resize_simple(n->textarea, n->textarea->leny, n->textarea->lenx + cols)){
|
||||
return -1;
|
||||
@ -207,12 +207,12 @@ int ncreader_write_egc(ncreader* n, const char* egc){
|
||||
if(ncplane_putegc(n->ncp, egc, NULL) < 0){
|
||||
return -1;
|
||||
}
|
||||
if(n->textarea->x >= (int)n->textarea->lenx - cols){
|
||||
if(n->textarea->x >= n->textarea->lenx - cols){
|
||||
if(!n->horscroll){
|
||||
n->textarea->x = n->textarea->lenx - cols;
|
||||
}
|
||||
}
|
||||
if(n->ncp->x >= (int)n->ncp->lenx - cols){
|
||||
if(n->ncp->x >= n->ncp->lenx - cols){
|
||||
n->ncp->x = n->ncp->lenx - cols;
|
||||
}
|
||||
ncreader_redraw(n);
|
||||
@ -275,7 +275,7 @@ ncreader_ctrl_input(ncreader* n, const ncinput* ni){
|
||||
}
|
||||
break;
|
||||
case 'E': // cursor to end of line
|
||||
while(n->textarea->x < (int)ncplane_dim_x(n->textarea) - 1){
|
||||
while(n->textarea->x < ncplane_dim_x(n->textarea) - 1){
|
||||
if(ncreader_move_right(n)){
|
||||
break;
|
||||
}
|
||||
@ -320,7 +320,7 @@ ncreader_alt_input(ncreader* n, const ncinput* ni){
|
||||
}
|
||||
break;
|
||||
case 'f': // forward one word (past end cell)
|
||||
while(n->textarea->x < (int)ncplane_dim_x(n->textarea) - 1){
|
||||
while(n->textarea->x < ncplane_dim_x(n->textarea) - 1){
|
||||
if(ncreader_move_right(n)){
|
||||
break;
|
||||
}
|
||||
|
@ -972,11 +972,11 @@ int sixel_scrub(const ncpile* p, sprixel* s){
|
||||
continue;
|
||||
}
|
||||
sprixel* trues = r->sprixel ? r->sprixel : s;
|
||||
if(yy >= trues->n->leny || yy - trues->n->absy < 0){
|
||||
if(yy >= (int)trues->n->leny || yy - trues->n->absy < 0){
|
||||
r->s.damaged = 1;
|
||||
continue;
|
||||
}
|
||||
if(xx >= trues->n->lenx || xx - trues->n->absx < 0){
|
||||
if(xx >= (int)trues->n->lenx || xx - trues->n->absx < 0){
|
||||
r->s.damaged = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ int main(void){
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
struct ncplane* stdn = notcurses_stdplane(nc);
|
||||
int cellpixy, cellpixx;
|
||||
unsigned cellpixy, cellpixx;
|
||||
ncplane_pixelgeom(stdn, NULL, NULL, &cellpixy, &cellpixx, NULL, NULL);
|
||||
if(interp(nc, cellpixy, cellpixx)){
|
||||
goto err;
|
||||
|
@ -102,7 +102,7 @@ int main(void){
|
||||
ncchannels_set_bg_rgb(&mopts.headerchannels, 0x440000);
|
||||
ncchannels_set_fg_rgb(&mopts.sectionchannels, 0xb0d700);
|
||||
ncchannels_set_bg_rgb(&mopts.sectionchannels, 0x002000);
|
||||
int dimy, dimx;
|
||||
unsigned dimy, dimx;
|
||||
struct ncplane* n = notcurses_stddim_yx(nc, &dimy, &dimx);
|
||||
struct ncmenu* top = ncmenu_create(n, &mopts);
|
||||
if(top == NULL){
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
static int
|
||||
render_qrcode(struct ncplane* n, int dimy, int dimx, const char* text){
|
||||
int y = dimy, x = dimx;
|
||||
unsigned y = dimy, x = dimx;
|
||||
ncplane_home(n);
|
||||
int ver = ncplane_qrcode(n, &y, &x, text, strlen(text));
|
||||
if(ver < 0){
|
||||
|
@ -28,8 +28,8 @@ int main(void){
|
||||
}
|
||||
const char* brew = "םבעברஸீரோகிரிﻧﺎﻠﻘﺻﺮﻴﻧﻖﺻﺭﺎoshitﻠﺷﻮﻗﺎﻠﺴﻛﺮﻳﺓ";
|
||||
const char *b = brew;
|
||||
for(int y = dimy / 2 + 2 ; y < dimy ; ++y){
|
||||
for(int x = 0 ; x < dimx ; ++x){
|
||||
for(unsigned y = dimy / 2 + 2 ; y < dimy ; ++y){
|
||||
for(unsigned x = 0 ; x < dimx ; ++x){
|
||||
int bytes;
|
||||
if(ncplane_putegc_yx(n, y, x, b, &bytes) <= 0){
|
||||
break;
|
||||
|
@ -577,8 +577,8 @@ TEST_CASE("Fills") {
|
||||
const char* qr = "a very simple qr code";
|
||||
unsigned dimy, dimx;
|
||||
ncplane_dim_yx(n_, &dimy, &dimx);
|
||||
int sdimy = dimy;
|
||||
int sdimx = dimx;
|
||||
unsigned sdimy = dimy;
|
||||
unsigned sdimx = dimx;
|
||||
CHECK(0 < ncplane_qrcode(n_, &sdimy, &sdimx, qr, strlen(qr)));
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user