inline ncplane_putsimple_yx()

This commit is contained in:
nick black 2020-04-05 23:40:09 -04:00 committed by Nick Black
parent 37b4d96794
commit 4a6ab358ba
4 changed files with 523 additions and 516 deletions

View File

@ -863,7 +863,14 @@ ncplane_putc(struct ncplane* n, const cell* c){
// Replace the cell at the specified coordinates with the provided 7-bit char
// 'c'. Advance the cursor by 1. On success, returns 1. On failure, returns -1.
// This works whether the underlying char is signed or unsigned.
int ncplane_putsimple_yx(struct ncplane* n, int y, int x, char c);
static inline int
ncplane_putsimple_yx(struct ncplane* n, int y, int x, char c){
cell ce = CELL_INITIALIZER(c, ncplane_attr(n), ncplane_channels(n));
if(!cell_simple_p(&ce)){
return -1;
}
return ncplane_putc_yx(n, y, x, &ce);
}
// Call ncplane_putsimple_yx() at the current cursor location.
static inline int

View File

@ -18,7 +18,8 @@ ncplane_putc(struct ncplane* n, const cell* c);**
**static inline int
ncplane_putsimple(struct ncplane* n, char c);**
**int ncplane_putsimple_yx(struct ncplane* n, int y, int x, char c);**
**static inline int
ncplane_putsimple_yx(struct ncplane* n, int y, int x, char c);**
**int ncplane_putsimple_stainable(struct ncplane* n, char c);**

File diff suppressed because it is too large Load Diff

View File

@ -1336,7 +1336,6 @@ int ncplane_putc_yx(ncplane* n, int y, int x, const cell* c){
// FIXME if new n->y >= n->leny, scroll everything up a line and reset n->y
}
if(ncplane_cursor_move_yx(n, y, x)){
fprintf(stderr, "CAN'T MOVE TO %d/%d (real: %d/%d)\n", y, x, n->y, n->x);
return -1;
}
// A wide character obliterates anything to its immediate right (and marks
@ -1380,14 +1379,6 @@ fprintf(stderr, "CAN'T MOVE TO %d/%d (real: %d/%d)\n", y, x, n->y, n->x);
return cols;
}
int ncplane_putsimple_yx(struct ncplane* n, int y, int x, char c){
cell ce = CELL_INITIALIZER(c, ncplane_attr(n), ncplane_channels(n));
if(!cell_simple_p(&ce)){
return -1;
}
return ncplane_putc_yx(n, y, x, &ce);
}
int ncplane_putegc_yx(struct ncplane* n, int y, int x, const char* gclust, int* sbytes){
cell c = CELL_TRIVIAL_INITIALIZER;
int primed = cell_prime(n, &c, gclust, n->attrword, n->channels);