2013-09-22 08:10:39 -07:00
|
|
|
#ifndef _TERMPTY_H__
|
|
|
|
#define _TERMPTY_H__ 1
|
|
|
|
|
|
|
|
#include "config.h"
|
2018-09-16 08:57:42 -07:00
|
|
|
#include "media.h"
|
2018-12-09 11:55:25 -08:00
|
|
|
#include "sb.h"
|
2013-09-22 08:10:39 -07:00
|
|
|
|
2013-05-05 07:10:44 -07:00
|
|
|
typedef struct _Termcell Termcell;
|
|
|
|
typedef struct _Termatt Termatt;
|
|
|
|
typedef struct _Termsave Termsave;
|
|
|
|
typedef struct _Termsavecomp Termsavecomp;
|
|
|
|
typedef struct _Termblock Termblock;
|
|
|
|
typedef struct _Termexp Termexp;
|
2018-10-17 13:53:31 -07:00
|
|
|
typedef struct _Termpty Termpty;
|
|
|
|
typedef struct _Termlink Term_Link;
|
2019-11-29 11:07:14 -08:00
|
|
|
typedef struct _TitleIconElem TitleIconElem;
|
2012-06-12 03:10:01 -07:00
|
|
|
|
|
|
|
#define COL_DEF 0
|
|
|
|
#define COL_BLACK 1
|
|
|
|
#define COL_RED 2
|
|
|
|
#define COL_GREEN 3
|
|
|
|
#define COL_YELLOW 4
|
|
|
|
#define COL_BLUE 5
|
|
|
|
#define COL_MAGENTA 6
|
|
|
|
#define COL_CYAN 7
|
|
|
|
#define COL_WHITE 8
|
2012-06-15 22:07:33 -07:00
|
|
|
#define COL_INVIS 9
|
2012-06-12 03:10:01 -07:00
|
|
|
|
2012-06-15 22:07:33 -07:00
|
|
|
#define COL_INVERSE 10
|
|
|
|
#define COL_INVERSEBG 11
|
2012-06-12 03:10:01 -07:00
|
|
|
|
2012-10-04 16:19:17 -07:00
|
|
|
#define MOUSE_OFF 0
|
2012-10-24 14:34:36 -07:00
|
|
|
#define MOUSE_X10 1 // Press only
|
|
|
|
#define MOUSE_NORMAL 2 // Press+release only
|
|
|
|
#define MOUSE_NORMAL_BTN_MOVE 3 // Press+release+motion while pressed
|
|
|
|
#define MOUSE_NORMAL_ALL_MOVE 4 // Press+release+all motion
|
2012-06-22 23:43:02 -07:00
|
|
|
|
2012-10-24 14:34:36 -07:00
|
|
|
#define MOUSE_EXT_NONE 0
|
|
|
|
#define MOUSE_EXT_UTF8 1
|
|
|
|
#define MOUSE_EXT_SGR 2
|
|
|
|
#define MOUSE_EXT_URXVT 3
|
|
|
|
|
2013-04-21 14:18:03 -07:00
|
|
|
// Only for testing purpose
|
|
|
|
//#define SUPPORT_80_132_COLUMNS 1
|
|
|
|
|
2014-09-15 03:01:22 -07:00
|
|
|
#define MOVIE_STATE_PLAY 0
|
|
|
|
#define MOVIE_STATE_PAUSE 1
|
|
|
|
#define MOVIE_STATE_STOP 2
|
|
|
|
|
2018-10-17 13:53:31 -07:00
|
|
|
#define HL_LINKS_MAX (1 << 16)
|
|
|
|
|
|
|
|
struct _Termlink
|
|
|
|
{
|
|
|
|
const char *key;
|
|
|
|
const char *url;
|
|
|
|
unsigned int refcount;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
struct _Termatt
|
|
|
|
{
|
|
|
|
unsigned char fg, bg;
|
|
|
|
unsigned short bold : 1;
|
|
|
|
unsigned short faint : 1;
|
|
|
|
unsigned short italic : 1;
|
2012-06-25 18:38:13 -07:00
|
|
|
unsigned short dblwidth : 1;
|
2012-06-12 03:10:01 -07:00
|
|
|
unsigned short underline : 1;
|
2012-06-25 18:38:13 -07:00
|
|
|
unsigned short blink : 1; // don't intend to support this currently
|
|
|
|
unsigned short blink2 : 1; // don't intend to support this currently
|
2012-06-12 03:10:01 -07:00
|
|
|
unsigned short inverse : 1;
|
|
|
|
unsigned short invisible : 1;
|
|
|
|
unsigned short strike : 1;
|
|
|
|
unsigned short fg256 : 1;
|
|
|
|
unsigned short bg256 : 1;
|
2012-06-18 06:59:09 -07:00
|
|
|
unsigned short fgintense : 1;
|
|
|
|
unsigned short bgintense : 1;
|
2012-06-12 03:10:01 -07:00
|
|
|
// below used for working out text from selections
|
|
|
|
unsigned short autowrapped : 1;
|
|
|
|
unsigned short newline : 1;
|
2014-04-06 05:42:38 -07:00
|
|
|
unsigned short fraktur : 1;
|
2018-03-13 01:15:32 -07:00
|
|
|
unsigned short framed : 1;
|
|
|
|
unsigned short encircled : 1;
|
2019-10-27 08:04:43 -07:00
|
|
|
unsigned short overlined : 1; // TODO: support it
|
|
|
|
unsigned short tab_inserted : 1;
|
|
|
|
unsigned short tab_last : 1;
|
2013-04-21 14:18:03 -07:00
|
|
|
#if defined(SUPPORT_80_132_COLUMNS)
|
|
|
|
unsigned short is_80_132_mode_allowed : 1;
|
2019-10-27 08:04:43 -07:00
|
|
|
unsigned short bit_padding : 9;
|
2016-12-18 09:48:03 -08:00
|
|
|
#else
|
2019-10-27 08:04:43 -07:00
|
|
|
unsigned short bit_padding : 10;
|
2013-04-21 14:18:03 -07:00
|
|
|
#endif
|
2018-10-13 10:15:57 -07:00
|
|
|
uint16_t link_id;
|
2012-06-12 03:10:01 -07:00
|
|
|
};
|
|
|
|
|
2018-11-20 14:03:21 -08:00
|
|
|
typedef struct _Backlog_Beacon{
|
|
|
|
int screen_y;
|
|
|
|
int backlog_y;
|
|
|
|
} Backlog_Beacon;
|
|
|
|
|
|
|
|
typedef struct _Term_State {
|
|
|
|
Termatt att;
|
|
|
|
unsigned char charset;
|
|
|
|
unsigned char charsetch;
|
|
|
|
unsigned char chset[4];
|
|
|
|
int top_margin, bottom_margin;
|
|
|
|
int left_margin, right_margin;
|
|
|
|
int had_cr_x, had_cr_y;
|
|
|
|
unsigned int lr_margins : 1;
|
|
|
|
unsigned int restrict_cursor : 1;
|
|
|
|
unsigned int multibyte : 1;
|
|
|
|
unsigned int alt_kp : 1;
|
|
|
|
unsigned int insert : 1;
|
|
|
|
unsigned int appcursor : 1;
|
|
|
|
unsigned int wrap : 1;
|
|
|
|
unsigned int wrapnext : 1;
|
|
|
|
unsigned int crlf : 1;
|
|
|
|
unsigned int send_bs : 1;
|
|
|
|
unsigned int kbd_lock : 1;
|
|
|
|
unsigned int reverse : 1;
|
|
|
|
unsigned int no_autorepeat : 1;
|
|
|
|
unsigned int cjk_ambiguous_wide : 1;
|
|
|
|
unsigned int hide_cursor : 1;
|
|
|
|
unsigned int combining_strike : 1;
|
2018-12-29 08:18:39 -08:00
|
|
|
unsigned int sace_rectangular : 1;
|
2018-11-20 14:03:21 -08:00
|
|
|
} Term_State;
|
|
|
|
|
|
|
|
typedef struct _Term_Cursor {
|
|
|
|
int cx;
|
|
|
|
int cy;
|
|
|
|
} Term_Cursor;
|
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
struct _Termpty
|
|
|
|
{
|
2013-04-20 00:54:11 -07:00
|
|
|
Evas_Object *obj;
|
2019-06-23 10:00:10 -07:00
|
|
|
Config *config;
|
2012-06-12 03:10:01 -07:00
|
|
|
Ecore_Event_Handler *hand_exe_exit;
|
|
|
|
Ecore_Fd_Handler *hand_fd;
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
void (*func) (void *data);
|
|
|
|
void *data;
|
2013-11-10 13:13:19 -08:00
|
|
|
} change, set_title, set_icon, cancel_sel, exited, bell, command;
|
2012-06-12 03:10:01 -07:00
|
|
|
} cb;
|
|
|
|
struct {
|
2018-04-22 08:27:14 -07:00
|
|
|
const char *icon;
|
|
|
|
/* dynamic title set by xterm, keep it in case user don't want a
|
|
|
|
* title any more by setting a empty title
|
|
|
|
*/
|
|
|
|
const char *title;
|
|
|
|
/* set by user */
|
|
|
|
const char *user_title;
|
2012-06-12 03:10:01 -07:00
|
|
|
} prop;
|
2012-06-30 17:24:30 -07:00
|
|
|
const char *cur_cmd;
|
2012-06-12 03:10:01 -07:00
|
|
|
Termcell *screen, *screen2;
|
2016-12-18 09:48:03 -08:00
|
|
|
unsigned int *tabs;
|
2015-06-28 14:37:04 -07:00
|
|
|
int circular_offset;
|
|
|
|
int circular_offset2;
|
2015-02-23 13:20:18 -08:00
|
|
|
Eina_Unicode *buf;
|
|
|
|
size_t buflen;
|
2017-09-18 13:01:42 -07:00
|
|
|
Eina_Unicode last_char;
|
2017-12-17 22:16:54 -08:00
|
|
|
Eina_Bool buf_have_zero;
|
2015-06-28 14:37:04 -07:00
|
|
|
unsigned char oldbuf[4];
|
|
|
|
Termsave *back;
|
2015-08-01 09:37:35 -07:00
|
|
|
size_t backsize, backpos;
|
2016-11-20 09:23:56 -08:00
|
|
|
/* this beacon in the backlog tells about the top line in screen
|
|
|
|
* coordinates that maps to a line in the backlog */
|
2018-11-20 14:03:21 -08:00
|
|
|
Backlog_Beacon backlog_beacon;
|
2013-01-28 08:06:26 -08:00
|
|
|
int w, h;
|
|
|
|
int fd, slavefd;
|
2018-12-09 11:55:25 -08:00
|
|
|
struct ty_sb write_buffer;
|
2013-01-28 08:06:26 -08:00
|
|
|
struct {
|
|
|
|
int curid;
|
|
|
|
Eina_Hash *blocks;
|
2013-04-20 00:54:11 -07:00
|
|
|
Eina_Hash *chid_map;
|
2013-01-28 08:06:26 -08:00
|
|
|
Eina_List *active;
|
2013-01-28 16:43:13 -08:00
|
|
|
Eina_List *expecting;
|
2014-08-28 12:04:00 -07:00
|
|
|
unsigned char on : 1;
|
2013-01-28 08:06:26 -08:00
|
|
|
} block;
|
2013-09-29 08:55:24 -07:00
|
|
|
struct {
|
2015-01-21 13:56:16 -08:00
|
|
|
/* start is always the start of the selection
|
|
|
|
* so end.y can be < start.y */
|
2013-09-29 08:55:24 -07:00
|
|
|
struct {
|
|
|
|
int x, y;
|
2015-01-21 13:56:16 -08:00
|
|
|
} start, end, orig;
|
2019-01-30 13:48:55 -08:00
|
|
|
Eina_Unicode *codepoints;
|
2015-01-19 13:55:22 -08:00
|
|
|
time_t last_click;
|
2014-08-28 12:04:00 -07:00
|
|
|
unsigned char is_box : 1;
|
2019-02-10 10:00:43 -08:00
|
|
|
unsigned char is_active : 1; // there is a visible selection
|
|
|
|
unsigned char makesel : 1; // selection is being worked on
|
2015-01-21 13:56:16 -08:00
|
|
|
unsigned char by_word : 1;
|
|
|
|
unsigned char by_line : 1;
|
|
|
|
unsigned char is_top_to_bottom : 1;
|
2013-09-29 08:55:24 -07:00
|
|
|
} selection;
|
2018-11-20 14:03:21 -08:00
|
|
|
Term_State termstate;
|
|
|
|
Term_Cursor cursor_state;
|
|
|
|
Term_Cursor cursor_save[2];
|
2012-06-20 07:12:26 -07:00
|
|
|
int exit_code;
|
2013-01-28 08:06:26 -08:00
|
|
|
pid_t pid;
|
2013-05-03 19:44:20 -07:00
|
|
|
unsigned int altbuf : 1;
|
2012-10-24 14:34:36 -07:00
|
|
|
unsigned int mouse_mode : 3;
|
2013-05-03 19:44:20 -07:00
|
|
|
unsigned int mouse_ext : 2;
|
2014-05-07 11:40:03 -07:00
|
|
|
unsigned int bracketed_paste : 1;
|
2018-12-11 13:56:05 -08:00
|
|
|
unsigned int decoding_error : 1;
|
2018-09-26 10:59:33 -07:00
|
|
|
struct {
|
|
|
|
Term_Link *links;
|
|
|
|
uint8_t *bitmap;
|
2018-10-12 09:12:15 -07:00
|
|
|
uint32_t size;
|
2018-09-26 10:59:33 -07:00
|
|
|
} hl;
|
2019-11-29 11:07:14 -08:00
|
|
|
TitleIconElem *title_icon_stack;
|
2012-06-12 03:10:01 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Termcell
|
|
|
|
{
|
2014-03-25 13:34:48 -07:00
|
|
|
Eina_Unicode codepoint;
|
|
|
|
Termatt att;
|
2012-06-12 03:10:01 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Termsave
|
|
|
|
{
|
2013-10-25 07:37:10 -07:00
|
|
|
unsigned int gen : 8;
|
2013-05-05 07:10:44 -07:00
|
|
|
unsigned int comp : 1;
|
|
|
|
unsigned int z : 1;
|
|
|
|
unsigned int w : 22;
|
2015-04-06 09:08:23 -07:00
|
|
|
/* TODO: union ? */
|
|
|
|
Termcell *cells;
|
2013-05-05 07:10:44 -07:00
|
|
|
};
|
|
|
|
|
2015-04-06 09:08:23 -07:00
|
|
|
/* TODO: RESIZE rewrite Termsavecomp */
|
2013-05-05 07:10:44 -07:00
|
|
|
struct _Termsavecomp
|
|
|
|
{
|
2013-10-25 07:37:10 -07:00
|
|
|
unsigned int gen : 8;
|
2013-05-05 07:10:44 -07:00
|
|
|
unsigned int comp : 1;
|
|
|
|
unsigned int z : 1;
|
|
|
|
unsigned int w : 22; // compressed size in bytes
|
|
|
|
unsigned int wout; // output width in Termcells
|
2012-06-12 03:10:01 -07:00
|
|
|
};
|
|
|
|
|
2013-01-28 08:06:26 -08:00
|
|
|
struct _Termblock
|
|
|
|
{
|
2013-04-20 00:54:11 -07:00
|
|
|
Termpty *pty;
|
|
|
|
const char *path, *link, *chid;
|
|
|
|
Evas_Object *obj;
|
|
|
|
Eina_List *cmds;
|
2013-01-28 08:06:26 -08:00
|
|
|
int id;
|
2018-09-16 08:57:42 -07:00
|
|
|
Media_Type type;
|
2013-01-29 07:54:47 -08:00
|
|
|
int refs;
|
2013-01-28 08:06:26 -08:00
|
|
|
short w, h;
|
|
|
|
short x, y;
|
2014-08-28 12:04:00 -07:00
|
|
|
unsigned char scale_stretch : 1;
|
|
|
|
unsigned char scale_center : 1;
|
|
|
|
unsigned char scale_fill : 1;
|
|
|
|
unsigned char thumb : 1;
|
|
|
|
unsigned char edje : 1;
|
|
|
|
|
|
|
|
unsigned char active : 1;
|
|
|
|
unsigned char was_active : 1;
|
|
|
|
unsigned char was_active_before : 1;
|
|
|
|
|
2014-09-15 03:01:22 -07:00
|
|
|
unsigned char mov_state : 2; // movie state marker
|
2013-01-28 08:06:26 -08:00
|
|
|
};
|
2012-07-13 01:46:33 -07:00
|
|
|
|
2013-01-28 16:43:13 -08:00
|
|
|
struct _Termexp
|
|
|
|
{
|
2018-11-16 04:52:47 -08:00
|
|
|
Eina_Unicode ch;
|
|
|
|
int left, id;
|
2013-01-28 16:43:13 -08:00
|
|
|
int x, y, w, h;
|
|
|
|
};
|
|
|
|
|
2018-10-12 09:12:15 -07:00
|
|
|
|
2013-01-28 08:06:26 -08:00
|
|
|
void termpty_init(void);
|
|
|
|
void termpty_shutdown(void);
|
|
|
|
|
2013-06-16 13:32:50 -07:00
|
|
|
Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
2019-06-23 10:00:10 -07:00
|
|
|
int w, int h, Config *config, const char *emotion_mod,
|
|
|
|
const char *title, Ecore_Window window_id);
|
2013-01-28 08:06:26 -08:00
|
|
|
void termpty_free(Termpty *ty);
|
2019-06-23 10:00:10 -07:00
|
|
|
void termpty_config_update(Termpty *ty, Config *config);
|
2015-08-01 09:37:35 -07:00
|
|
|
|
2015-08-09 05:10:12 -07:00
|
|
|
Termcell *termpty_cellrow_get(Termpty *ty, int y, ssize_t *wret);
|
2018-10-13 09:07:27 -07:00
|
|
|
Termcell * termpty_cell_get(Termpty *ty, int y_requested, int x_requested);
|
2015-01-18 10:29:39 -08:00
|
|
|
ssize_t termpty_row_length(Termpty *ty, int y);
|
2013-01-28 08:06:26 -08:00
|
|
|
void termpty_write(Termpty *ty, const char *input, int len);
|
2015-04-06 09:08:23 -07:00
|
|
|
void termpty_resize(Termpty *ty, int new_w, int new_h);
|
2017-05-16 15:05:15 -07:00
|
|
|
void termpty_resize_tabs(Termpty *ty, int old_w, int new_w);
|
2015-04-06 09:08:23 -07:00
|
|
|
void termpty_backscroll_adjust(Termpty *ty, int *scroll);
|
2013-01-28 08:06:26 -08:00
|
|
|
|
|
|
|
pid_t termpty_pid_get(const Termpty *ty);
|
|
|
|
void termpty_block_free(Termblock *tb);
|
2013-03-11 00:56:07 -07:00
|
|
|
Termblock *termpty_block_new(Termpty *ty, int w, int h, const char *path, const char *link);
|
2013-01-28 16:43:13 -08:00
|
|
|
void termpty_block_insert(Termpty *ty, int ch, Termblock *blk);
|
2017-07-06 11:55:02 -07:00
|
|
|
int termpty_block_id_get(const Termcell *cell, int *x, int *y);
|
|
|
|
Termblock *termpty_block_get(const Termpty *ty, int id);
|
2013-04-20 00:54:11 -07:00
|
|
|
void termpty_block_chid_update(Termpty *ty, Termblock *blk);
|
2017-07-06 11:55:02 -07:00
|
|
|
Termblock *termpty_block_chid_get(const Termpty *ty, const char *chid);
|
2012-10-09 10:09:26 -07:00
|
|
|
|
2014-03-25 13:34:48 -07:00
|
|
|
void termpty_cell_codepoint_att_fill(Termpty *ty, Eina_Unicode codepoint, Termatt att, Termcell *dst, int n);
|
2017-06-26 12:58:59 -07:00
|
|
|
void termpty_cells_set_content(Termpty *ty, Termcell *cells,
|
|
|
|
Eina_Unicode codepoint, int count);
|
2013-11-18 12:41:30 -08:00
|
|
|
void termpty_screen_swap(Termpty *ty);
|
2013-01-29 07:54:47 -08:00
|
|
|
|
2013-03-17 11:27:20 -07:00
|
|
|
ssize_t termpty_line_length(const Termcell *cells, ssize_t nb_cells);
|
|
|
|
|
2015-11-02 15:07:22 -08:00
|
|
|
void termpty_handle_buf(Termpty *ty, const Eina_Unicode *codepoints, int len);
|
2017-09-08 15:18:02 -07:00
|
|
|
void termpty_handle_block_codepoint_overwrite_heavy(Termpty *ty, int oldc, int newc);
|
2013-09-22 08:10:39 -07:00
|
|
|
|
2018-10-17 13:53:31 -07:00
|
|
|
Term_Link * term_link_new(Termpty *ty);
|
|
|
|
void term_link_free(Termpty *ty, Term_Link *link);
|
|
|
|
|
2019-05-26 13:55:22 -07:00
|
|
|
int
|
|
|
|
termpty_color_class_get(Termpty *ty, const char *key,
|
|
|
|
int *r, int *g, int *b, int *a);
|
|
|
|
|
2012-07-13 01:46:33 -07:00
|
|
|
extern int _termpty_log_dom;
|
2013-01-21 06:02:32 -08:00
|
|
|
|
|
|
|
#define TERMPTY_SCREEN(Tpty, X, Y) \
|
|
|
|
Tpty->screen[X + (((Y + Tpty->circular_offset) % Tpty->h) * Tpty->w)]
|
2013-09-22 08:10:39 -07:00
|
|
|
|
2015-06-02 13:48:50 -07:00
|
|
|
#define TERMPTY_RESTRICT_FIELD(Field, Min, Max) \
|
|
|
|
do { \
|
|
|
|
if (Field >= Max) \
|
|
|
|
Field = Max - 1; \
|
|
|
|
else if (Field < Min) \
|
|
|
|
Field = Min; \
|
|
|
|
} while (0)
|
|
|
|
|
2017-09-08 15:18:02 -07:00
|
|
|
/* Try to trick the compiler into inlining the first test */
|
|
|
|
#define HANDLE_BLOCK_CODEPOINT_OVERWRITE(Tpty, OLDC, NEWC) \
|
|
|
|
do { \
|
|
|
|
if (EINA_UNLIKELY((OLDC | NEWC) & 0x80000000)) \
|
|
|
|
termpty_handle_block_codepoint_overwrite_heavy(Tpty, OLDC, NEWC); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define TERMPTY_CELL_COPY(Tpty, Tsrc, Tdst, N) \
|
|
|
|
do { \
|
|
|
|
int __i; \
|
|
|
|
\
|
|
|
|
for (__i = 0; __i < N; __i++) \
|
|
|
|
{ \
|
|
|
|
HANDLE_BLOCK_CODEPOINT_OVERWRITE(Tpty, \
|
|
|
|
(Tdst)[__i].codepoint, \
|
|
|
|
(Tsrc)[__i].codepoint); \
|
2018-10-12 09:12:15 -07:00
|
|
|
if (EINA_UNLIKELY((Tdst)[__i].att.link_id)) \
|
2018-10-13 10:15:57 -07:00
|
|
|
term_link_refcount_dec(ty, (Tdst)[__i].att.link_id, 1); \
|
|
|
|
if (EINA_UNLIKELY((Tsrc)[__i].att.link_id)) \
|
|
|
|
term_link_refcount_inc(ty, (Tsrc)[__i].att.link_id, 1); \
|
2017-09-08 15:18:02 -07:00
|
|
|
} \
|
|
|
|
memcpy(Tdst, Tsrc, N * sizeof(Termcell)); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
2018-10-12 09:12:15 -07:00
|
|
|
static inline void
|
|
|
|
term_link_refcount_inc(Termpty *ty, uint16_t link_id, uint16_t count)
|
|
|
|
{
|
|
|
|
Term_Link *link;
|
|
|
|
|
|
|
|
link = &ty->hl.links[link_id];
|
|
|
|
link->refcount += count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
term_link_refcount_dec(Termpty *ty, uint16_t link_id, uint16_t count)
|
|
|
|
{
|
|
|
|
Term_Link *link;
|
2018-09-26 10:59:33 -07:00
|
|
|
|
2018-10-12 09:12:15 -07:00
|
|
|
link = &ty->hl.links[link_id];
|
|
|
|
link->refcount -= count;
|
|
|
|
if (EINA_UNLIKELY(link->refcount == 0))
|
|
|
|
term_link_free(ty, link);
|
|
|
|
}
|
2018-09-26 10:59:33 -07:00
|
|
|
|
2018-10-13 10:15:57 -07:00
|
|
|
static inline Eina_Bool
|
|
|
|
term_link_eq(Termpty *ty, Term_Link *hl, uint16_t link_id)
|
|
|
|
{
|
|
|
|
Term_Link *hl2;
|
|
|
|
uint16_t hl_id;
|
|
|
|
|
|
|
|
if (link_id == 0)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
hl_id = hl - ty->hl.links;
|
|
|
|
if (hl_id == link_id)
|
|
|
|
return EINA_TRUE;
|
|
|
|
hl2 = &ty->hl.links[link_id];
|
|
|
|
if (!hl->key || !hl2->key ||
|
|
|
|
strcmp(hl->key, hl2->key) != 0)
|
|
|
|
return EINA_FALSE;
|
2018-10-15 12:41:27 -07:00
|
|
|
return (strcmp(hl->url, hl2->url) == 0);
|
2018-10-13 10:15:57 -07:00
|
|
|
}
|
|
|
|
|
2018-10-12 09:12:15 -07:00
|
|
|
static inline void
|
|
|
|
termpty_cell_fill(Termpty *ty, Termcell *src, Termcell *dst, int n)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (src)
|
|
|
|
{
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
{
|
|
|
|
HANDLE_BLOCK_CODEPOINT_OVERWRITE(ty, dst[i].codepoint, src[0].codepoint);
|
|
|
|
if (EINA_UNLIKELY(dst[i].att.link_id))
|
|
|
|
term_link_refcount_dec(ty, dst[i].att.link_id, 1);
|
|
|
|
|
|
|
|
dst[i] = src[0];
|
|
|
|
}
|
|
|
|
if (src[0].att.link_id)
|
2018-10-13 10:15:57 -07:00
|
|
|
term_link_refcount_inc(ty, src[0].att.link_id, n);
|
2018-10-12 09:12:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
{
|
|
|
|
HANDLE_BLOCK_CODEPOINT_OVERWRITE(ty, dst[i].codepoint, 0);
|
|
|
|
if (EINA_UNLIKELY(dst[i].att.link_id))
|
|
|
|
term_link_refcount_dec(ty, dst[i].att.link_id, 1);
|
|
|
|
|
|
|
|
memset(&(dst[i]), 0, sizeof(*dst));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-09-22 08:10:39 -07:00
|
|
|
#endif
|