mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
ncneofetch: always center paletteplane
This commit is contained in:
parent
78dcdd4faf
commit
43f2504259
@ -358,7 +358,13 @@ drawpalette(struct notcurses* nc){
|
||||
return -1;
|
||||
}
|
||||
for(int y = 0 ; y < (psize + 63) / 64 ; ++y){
|
||||
if(ncplane_cursor_move_yx(n, -1, (dimx - 64) / 2)){
|
||||
// we show a maximum of 64 palette entries per line
|
||||
int toshow = psize - y * 64;
|
||||
if(toshow > 64){
|
||||
toshow = 64;
|
||||
}
|
||||
// center based on the number being shown on this line
|
||||
if(ncplane_cursor_move_yx(n, -1, (dimx - toshow) / 2)){
|
||||
return -1;
|
||||
}
|
||||
for(int x = (dimx - 64) / 2 ; x < dimx / 2 + 32 ; ++x){
|
||||
|
@ -1210,7 +1210,7 @@ mouse_disable(fbuf* f){
|
||||
// don't know where the cursor currently is =].
|
||||
static inline int
|
||||
goto_location(notcurses* nc, fbuf* f, int y, int x){
|
||||
//fprintf(stderr, "going to %d/%d from %d/%d hard: %u\n", y, x, nc->rstate.y, nc->rstate.x, hardcursorpos);
|
||||
//fprintf(stderr, "going to %d/%d from %d/%d hard: %u\n", y, x, nc->rstate.y, nc->rstate.x, nc->rstate.hardcursorpos);
|
||||
int ret = 0;
|
||||
// if we don't have hpa, force a cup even if we're only 1 char away. the only
|
||||
// TERM i know supporting cup sans hpa is vt100, and vt100 can suck it.
|
||||
|
@ -197,18 +197,17 @@ void fbcon_scroll(const struct ncpile* p, tinfo* ti, int rows){
|
||||
return;
|
||||
}
|
||||
int totalrows = ti->cellpixy * p->dimy;
|
||||
int srows = rows * ti->cellpixy; // number of lines being scrolled
|
||||
int srows = rows * ti->cellpixy; // number of pixel rows being scrolled
|
||||
if(srows > totalrows){
|
||||
srows = totalrows;
|
||||
}
|
||||
int rowbytes = ti->cellpixx * p->dimx * 4;
|
||||
uint8_t* targ = ti->linux_fbuffer;
|
||||
uint8_t* src = ti->linux_fbuffer + srows * ti->cellpixx * p->dimx * 4;
|
||||
for(int r = 0 ; r < totalrows - srows ; ++r){
|
||||
memcpy(targ, src, ti->cellpixx * p->dimx * 4);
|
||||
targ += ti->cellpixx * p->dimx * 4;
|
||||
src += ti->cellpixx * p->dimx * 4;
|
||||
}
|
||||
for(int r = totalrows - srows ; r < totalrows ; ++r){
|
||||
memset(targ, 0, ti->cellpixx * p->dimx * 4);
|
||||
targ += ti->cellpixx * p->dimx * 4;
|
||||
}
|
||||
uint8_t* src = ti->linux_fbuffer + srows * rowbytes;
|
||||
unsigned tocopy = rowbytes * (totalrows - srows);
|
||||
memmove(targ, src, tocopy);
|
||||
targ += tocopy;
|
||||
memset(targ, 0, srows * rowbytes);
|
||||
}
|
||||
|
||||
// each row is a contiguous set of bits, starting at the msb
|
||||
|
Loading…
x
Reference in New Issue
Block a user