tmux  3.2a
About: tmux is a terminal multiplexer that lets you switch easily between several programs in one terminal.
  Fossies Dox: tmux-3.2a.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

grid.c File Reference
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include "tmux.h"
Include dependency graph for grid.c:

Go to the source code of this file.

Functions

static void grid_store_cell (struct grid_cell_entry *gce, const struct grid_cell *gc, u_char c)
 
static int grid_need_extended_cell (const struct grid_cell_entry *gce, const struct grid_cell *gc)
 
static void grid_get_extended_cell (struct grid_line *gl, struct grid_cell_entry *gce, int flags)
 
static struct grid_extd_entrygrid_extended_cell (struct grid_line *gl, struct grid_cell_entry *gce, const struct grid_cell *gc)
 
static void grid_compact_line (struct grid_line *gl)
 
struct grid_linegrid_get_line (struct grid *gd, u_int line)
 
void grid_adjust_lines (struct grid *gd, u_int lines)
 
static void grid_clear_cell (struct grid *gd, u_int px, u_int py, u_int bg)
 
static int grid_check_y (struct grid *gd, const char *from, u_int py)
 
int grid_cells_look_equal (const struct grid_cell *gc1, const struct grid_cell *gc2)
 
int grid_cells_equal (const struct grid_cell *gc1, const struct grid_cell *gc2)
 
static void grid_free_line (struct grid *gd, u_int py)
 
static void grid_free_lines (struct grid *gd, u_int py, u_int ny)
 
struct gridgrid_create (u_int sx, u_int sy, u_int hlimit)
 
void grid_destroy (struct grid *gd)
 
int grid_compare (struct grid *ga, struct grid *gb)
 
static void grid_trim_history (struct grid *gd, u_int ny)
 
void grid_collect_history (struct grid *gd)
 
void grid_remove_history (struct grid *gd, u_int ny)
 
void grid_scroll_history (struct grid *gd, u_int bg)
 
void grid_clear_history (struct grid *gd)
 
void grid_scroll_history_region (struct grid *gd, u_int upper, u_int lower, u_int bg)
 
static void grid_expand_line (struct grid *gd, u_int py, u_int sx, u_int bg)
 
void grid_empty_line (struct grid *gd, u_int py, u_int bg)
 
const struct grid_linegrid_peek_line (struct grid *gd, u_int py)
 
static void grid_get_cell1 (struct grid_line *gl, u_int px, struct grid_cell *gc)
 
void grid_get_cell (struct grid *gd, u_int px, u_int py, struct grid_cell *gc)
 
void grid_set_cell (struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
 
void grid_set_padding (struct grid *gd, u_int px, u_int py)
 
void grid_set_cells (struct grid *gd, u_int px, u_int py, const struct grid_cell *gc, const char *s, size_t slen)
 
void grid_clear (struct grid *gd, u_int px, u_int py, u_int nx, u_int ny, u_int bg)
 
void grid_clear_lines (struct grid *gd, u_int py, u_int ny, u_int bg)
 
void grid_move_lines (struct grid *gd, u_int dy, u_int py, u_int ny, u_int bg)
 
void grid_move_cells (struct grid *gd, u_int dx, u_int px, u_int py, u_int nx, u_int bg)
 
static size_t grid_string_cells_fg (const struct grid_cell *gc, int *values)
 
static size_t grid_string_cells_bg (const struct grid_cell *gc, int *values)
 
static void grid_string_cells_code (const struct grid_cell *lastgc, const struct grid_cell *gc, char *buf, size_t len, int escape_c0)
 
char * grid_string_cells (struct grid *gd, u_int px, u_int py, u_int nx, struct grid_cell **lastgc, int with_codes, int escape_c0, int trim)
 
void grid_duplicate_lines (struct grid *dst, u_int dy, struct grid *src, u_int sy, u_int ny)
 
static void grid_reflow_dead (struct grid_line *gl)
 
static struct grid_linegrid_reflow_add (struct grid *gd, u_int n)
 
static struct grid_linegrid_reflow_move (struct grid *gd, struct grid_line *from)
 
static void grid_reflow_join (struct grid *target, struct grid *gd, u_int sx, u_int yy, u_int width, int already)
 
static void grid_reflow_split (struct grid *target, struct grid *gd, u_int sx, u_int yy, u_int at)
 
void grid_reflow (struct grid *gd, u_int sx)
 
void grid_wrap_position (struct grid *gd, u_int px, u_int py, u_int *wx, u_int *wy)
 
void grid_unwrap_position (struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy)
 
u_int grid_line_length (struct grid *gd, u_int py)
 

Variables

const struct grid_cell grid_default_cell
 
static const struct grid_cell grid_padding_cell
 
static const struct grid_cell grid_cleared_cell
 
static const struct grid_cell_entry grid_cleared_entry
 

Function Documentation

◆ grid_adjust_lines()

void grid_adjust_lines ( struct grid gd,
u_int  lines 
)

Definition at line 188 of file grid.c.

References grid::linedata, and xreallocarray().

Referenced by screen_resize_y().

◆ grid_cells_equal()

int grid_cells_equal ( const struct grid_cell gc1,
const struct grid_cell gc2 
)

◆ grid_cells_look_equal()

int grid_cells_look_equal ( const struct grid_cell gc1,
const struct grid_cell gc2 
)

Definition at line 228 of file grid.c.

References grid_cell::attr, grid_cell::bg, grid_cell::fg, and grid_cell::flags.

Referenced by grid_cells_equal(), and window_redraw_active_switch().

◆ grid_check_y()

static int grid_check_y ( struct grid gd,
const char *  from,
u_int  py 
)
static

◆ grid_clear()

◆ grid_clear_cell()

static void grid_clear_cell ( struct grid gd,
u_int  px,
u_int  py,
u_int  bg 
)
static

◆ grid_clear_history()

void grid_clear_history ( struct grid gd)

◆ grid_clear_lines()

void grid_clear_lines ( struct grid gd,
u_int  py,
u_int  ny,
u_int  bg 
)

Definition at line 639 of file grid.c.

References grid_line::flags, grid_check_y(), grid_empty_line(), grid_free_line(), and grid::linedata.

Referenced by grid_clear(), and screen_reinit().

◆ grid_collect_history()

void grid_collect_history ( struct grid gd)

◆ grid_compact_line()

static void grid_compact_line ( struct grid_line gl)
static

◆ grid_compare()

int grid_compare ( struct grid ga,
struct grid gb 
)

◆ grid_create()

struct grid* grid_create ( u_int  sx,
u_int  sy,
u_int  hlimit 
)

◆ grid_destroy()

void grid_destroy ( struct grid gd)

Definition at line 299 of file grid.c.

References grid_free_lines(), grid::hsize, grid::linedata, and grid::sy.

Referenced by screen_alternate_off(), and screen_free().

◆ grid_duplicate_lines()

void grid_duplicate_lines ( struct grid dst,
u_int  dy,
struct grid src,
u_int  sy,
u_int  ny 
)

◆ grid_empty_line()

void grid_empty_line ( struct grid gd,
u_int  py,
u_int  bg 
)

◆ grid_expand_line()

static void grid_expand_line ( struct grid gd,
u_int  py,
u_int  sx,
u_int  bg 
)
static

◆ grid_extended_cell()

◆ grid_free_line()

static void grid_free_line ( struct grid gd,
u_int  py 
)
static

◆ grid_free_lines()

static void grid_free_lines ( struct grid gd,
u_int  py,
u_int  ny 
)
static

Definition at line 262 of file grid.c.

References grid_free_line().

Referenced by grid_destroy(), grid_duplicate_lines(), and grid_trim_history().

◆ grid_get_cell()

◆ grid_get_cell1()

◆ grid_get_extended_cell()

static void grid_get_extended_cell ( struct grid_line gl,
struct grid_cell_entry gce,
int  flags 
)
static

◆ grid_get_line()

◆ grid_line_length()

◆ grid_move_cells()

void grid_move_cells ( struct grid gd,
u_int  dx,
u_int  px,
u_int  py,
u_int  nx,
u_int  bg 
)

◆ grid_move_lines()

void grid_move_lines ( struct grid gd,
u_int  dy,
u_int  py,
u_int  ny,
u_int  bg 
)

◆ grid_need_extended_cell()

static int grid_need_extended_cell ( const struct grid_cell_entry gce,
const struct grid_cell gc 
)
static

◆ grid_peek_line()

const struct grid_line* grid_peek_line ( struct grid gd,
u_int  py 
)

◆ grid_reflow()

◆ grid_reflow_add()

static struct grid_line* grid_reflow_add ( struct grid gd,
u_int  n 
)
static

Definition at line 1072 of file grid.c.

References grid::linedata, grid::sy, and xreallocarray().

Referenced by grid_reflow(), grid_reflow_move(), and grid_reflow_split().

◆ grid_reflow_dead()

static void grid_reflow_dead ( struct grid_line gl)
static

Definition at line 1064 of file grid.c.

References grid_line::flags, and GRID_LINE_DEAD.

Referenced by grid_reflow_join(), grid_reflow_move(), and grid_reflow_split().

◆ grid_reflow_join()

static void grid_reflow_join ( struct grid target,
struct grid gd,
u_int  sx,
u_int  yy,
u_int  width,
int  already 
)
static

◆ grid_reflow_move()

static struct grid_line* grid_reflow_move ( struct grid gd,
struct grid_line from 
)
static

Definition at line 1086 of file grid.c.

References grid_reflow_add(), and grid_reflow_dead().

Referenced by grid_reflow(), and grid_reflow_join().

◆ grid_reflow_split()

static void grid_reflow_split ( struct grid target,
struct grid gd,
u_int  sx,
u_int  yy,
u_int  at 
)
static

◆ grid_remove_history()

void grid_remove_history ( struct grid gd,
u_int  ny 
)

Definition at line 375 of file grid.c.

References grid_free_line(), grid::hsize, and grid::sy.

◆ grid_scroll_history()

void grid_scroll_history ( struct grid gd,
u_int  bg 
)

◆ grid_scroll_history_region()

void grid_scroll_history_region ( struct grid gd,
u_int  upper,
u_int  lower,
u_int  bg 
)

◆ grid_set_cell()

◆ grid_set_cells()

void grid_set_cells ( struct grid gd,
u_int  px,
u_int  py,
const struct grid_cell gc,
const char *  s,
size_t  slen 
)

◆ grid_set_padding()

void grid_set_padding ( struct grid gd,
u_int  px,
u_int  py 
)

Definition at line 563 of file grid.c.

References grid_padding_cell, and grid_set_cell().

Referenced by grid_view_set_padding().

◆ grid_store_cell()

static void grid_store_cell ( struct grid_cell_entry gce,
const struct grid_cell gc,
u_char  c 
)
static

◆ grid_string_cells()

char* grid_string_cells ( struct grid gd,
u_int  px,
u_int  py,
u_int  nx,
struct grid_cell **  lastgc,
int  with_codes,
int  escape_c0,
int  trim 
)

◆ grid_string_cells_bg()

static size_t grid_string_cells_bg ( const struct grid_cell gc,
int *  values 
)
static

Definition at line 782 of file grid.c.

References grid_cell::bg, COLOUR_FLAG_256, COLOUR_FLAG_RGB, and colour_split_rgb().

Referenced by grid_string_cells_code().

◆ grid_string_cells_code()

◆ grid_string_cells_fg()

static size_t grid_string_cells_fg ( const struct grid_cell gc,
int *  values 
)
static

Definition at line 733 of file grid.c.

References COLOUR_FLAG_256, COLOUR_FLAG_RGB, colour_split_rgb(), and grid_cell::fg.

Referenced by grid_string_cells_code().

◆ grid_trim_history()

static void grid_trim_history ( struct grid gd,
u_int  ny 
)
static

Definition at line 337 of file grid.c.

References grid_free_lines(), grid::hsize, grid::linedata, and grid::sy.

Referenced by grid_clear_history(), and grid_collect_history().

◆ grid_unwrap_position()

void grid_unwrap_position ( struct grid gd,
u_int *  px,
u_int *  py,
u_int  wx,
u_int  wy 
)

◆ grid_wrap_position()

void grid_wrap_position ( struct grid gd,
u_int  px,
u_int  py,
u_int *  wx,
u_int *  wy 
)

Variable Documentation

◆ grid_cleared_cell

const struct grid_cell grid_cleared_cell
static
Initial value:
= {
{ { ' ' }, 0, 1, 1 }, 0, 0x40 , 8, 8, 0
}

Definition at line 1 of file grid.c.

Referenced by grid_clear_cell().

◆ grid_cleared_entry

const struct grid_cell_entry grid_cleared_entry
static
Initial value:
= {
0x40 , { .data = { 0, 8, 8, ' ' } }
}

Definition at line 1 of file grid.c.

Referenced by grid_clear_cell().

◆ grid_default_cell

◆ grid_padding_cell

const struct grid_cell grid_padding_cell
static
Initial value:
= {
{ { '!' }, 0, 0, 0 }, 0, 0x4 , 8, 8, 0
}

Definition at line 1 of file grid.c.

Referenced by grid_set_padding().