@@ -65,7 +65,7 @@ extern "C" {
6565
6666// __ffi_start
6767
68- #define TB_VERSION_STR "2.6 .0-dev"
68+ #define TB_VERSION_STR "2.7 .0-dev"
6969
7070/* The following compile-time options are supported:
7171 *
@@ -512,6 +512,25 @@ int tb_set_cell_ex(int x, int y, uint32_t *ch, size_t nch, uintattr_t fg,
512512 uintattr_t bg );
513513int tb_extend_cell (int x , int y , uint32_t ch );
514514
515+ /* Return a pointer to the cell at the specified position.
516+ *
517+ * Cell memory may be invalid or freed after subsequent library calls, so
518+ * callers must copy any data that they need to persist across calls. Modifying
519+ * cell memory results in undefined behavior.
520+ *
521+ * Callers may use pointer math to access cells relative to the requested one.
522+ * The cell grid memory layout is a contiguous array indexable by the expression
523+ * `(y * width) + x`.
524+ *
525+ * If `back` is non-zero, return cell from the internal back buffer. Otherwise,
526+ * return cell from the front buffer. Note the front buffer is updated on each
527+ * call to `tb_present`, whereas the back buffer is updated immediately by
528+ * `tb_set_cell` and other functions that modify cell contents.
529+ *
530+ * If the position is invalid, `TB_ERR_OUT_OF_BOUNDS` is returned.
531+ */
532+ int tb_get_cell (int x , int y , int back , struct tb_cell * * cell );
533+
515534/* Set the input mode. Termbox has two input modes:
516535 *
517536 * 1. `TB_INPUT_ESC`
@@ -2505,6 +2524,11 @@ int tb_set_cell_ex(int x, int y, uint32_t *ch, size_t nch, uintattr_t fg,
25052524 return TB_OK ;
25062525}
25072526
2527+ int tb_get_cell (int x , int y , int back , struct tb_cell * * cell ) {
2528+ if_not_init_return ();
2529+ return cellbuf_get (back ? & global .back : & global .front , x , y , cell );
2530+ }
2531+
25082532int tb_extend_cell (int x , int y , uint32_t ch ) {
25092533 if_not_init_return ();
25102534#ifdef TB_OPT_EGC
0 commit comments