mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
Remove all deprecated calls to tb_cell_buffer()
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -506,6 +506,21 @@ int tb_set_cell_ex(int x, int y, uint32_t *ch, size_t nch, uintattr_t fg,
|
||||
uintattr_t bg);
|
||||
int tb_extend_cell(int x, int y, uint32_t ch);
|
||||
|
||||
/* Get cell at specified position.
|
||||
*
|
||||
* If position is valid, function returns TB_OK and cell contents are copied to
|
||||
* `cell`. Note if `nech>0`, then `ech` will be a pointer to memory which may
|
||||
* be invalid or freed after subsequent library calls. Callers must copy this
|
||||
* memory if they need to persist it for some reason. Modifying memory at `ech`
|
||||
* results in undefined behavior.
|
||||
*
|
||||
* If `back` is non-zero, return cells from the internal back buffer. Otherwise,
|
||||
* return cells from the front buffer. Note the front buffer is updated on each
|
||||
* call to tb_present(), whereas the back buffer is updated immediately by
|
||||
* tb_set_cell() and other functions that mutate cell contents.
|
||||
*/
|
||||
int tb_get_cell(int x, int y, int back, struct tb_cell *cell);
|
||||
|
||||
/* Set the input mode. Termbox has two input modes:
|
||||
*
|
||||
* 1. `TB_INPUT_ESC`
|
||||
@@ -1771,6 +1786,15 @@ int tb_set_cell_ex(int x, int y, uint32_t *ch, size_t nch, uintattr_t fg,
|
||||
return TB_OK;
|
||||
}
|
||||
|
||||
int tb_get_cell(int x, int y, int back, struct tb_cell *cell) {
|
||||
if_not_init_return();
|
||||
int rv;
|
||||
struct tb_cell *cellp = NULL;
|
||||
rv = cellbuf_get(back ? &global.back : &global.front, x, y, &cellp);
|
||||
if (cellp) memcpy(cell, cellp, sizeof(*cell));
|
||||
return rv;
|
||||
}
|
||||
|
||||
int tb_extend_cell(int x, int y, uint32_t ch) {
|
||||
if_not_init_return();
|
||||
#ifdef TB_OPT_EGC
|
||||
@@ -3271,14 +3295,6 @@ static int send_cluster(int x, int y, uint32_t *ch, size_t nch) {
|
||||
ch32 = 0xfffd; // replace non-printable codepoints with U+FFFD
|
||||
}
|
||||
int chu8_len = tb_utf8_unicode_to_char(chu8, ch32);
|
||||
/*
|
||||
if (ch32 == 0) { // replace null with space (from termbox 19dbee5)
|
||||
chu8_len = 1;
|
||||
chu8[0] = ' ';
|
||||
} else {
|
||||
chu8_len = tb_utf8_unicode_to_char(chu8, ch32);
|
||||
}
|
||||
*/
|
||||
if_err_return(rv, bytebuf_nputs(&global.out, chu8, (size_t)chu8_len));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user