termpty: attach a Config * to Termpty
This commit is contained in:
parent
7cc1197a53
commit
7b3110d4a2
|
@ -120,7 +120,7 @@ keyin_handle_key_to_pty(Termpty *ty, const Evas_Event_Key_Down *ev,
|
|||
}
|
||||
else
|
||||
{
|
||||
Config *cfg = termpty_config_get(ty);
|
||||
const Config *cfg = ty->config;
|
||||
|
||||
if (cfg->erase_is_del && !ctrl)
|
||||
{
|
||||
|
|
|
@ -423,7 +423,7 @@ termio_config_update(Evas_Object *obj)
|
|||
sd->jump_on_change = sd->config->jump_on_change;
|
||||
sd->jump_on_keypress = sd->config->jump_on_keypress;
|
||||
|
||||
termpty_backlog_size_set(sd->pty, sd->config->scrollback);
|
||||
termpty_config_update(sd->pty, sd->config);
|
||||
sd->scroll = 0;
|
||||
|
||||
colors_term_init(sd->grid.obj, sd->theme, sd->config);
|
||||
|
@ -3981,9 +3981,8 @@ termio_add(Evas_Object *win, Config *config,
|
|||
_smart_cb_drop, obj);
|
||||
|
||||
window_id = elm_win_window_id_get(win);
|
||||
sd->pty = termpty_new(cmd, login_shell, cd, w, h, config->scrollback,
|
||||
config->xterm_256color, config->erase_is_del, mod,
|
||||
title, window_id);
|
||||
sd->pty = termpty_new(cmd, login_shell, cd, w, h, config, mod, title,
|
||||
window_id);
|
||||
if (!sd->pty)
|
||||
{
|
||||
ERR(_("Could not allocate termpty"));
|
||||
|
|
|
@ -479,8 +479,7 @@ _is_shell_valid(const char *cmd)
|
|||
|
||||
Termpty *
|
||||
termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||
int w, int h, int backscroll, Eina_Bool xterm_256color,
|
||||
Eina_Bool erase_is_del, const char *emotion_mod,
|
||||
int w, int h, Config *config, const char *emotion_mod,
|
||||
const char *title, Ecore_Window window_id)
|
||||
{
|
||||
Termpty *ty;
|
||||
|
@ -494,9 +493,10 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
|||
|
||||
ty = calloc(1, sizeof(Termpty));
|
||||
if (!ty) return NULL;
|
||||
ty->config = config;
|
||||
ty->w = w;
|
||||
ty->h = h;
|
||||
ty->backsize = backscroll;
|
||||
ty->backsize = config->scrollback;
|
||||
|
||||
ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h);
|
||||
if (!ty->screen)
|
||||
|
@ -629,7 +629,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
|||
ERR("unable to tcgetattr: %s", strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
t.c_cc[VERASE] = (erase_is_del) ? 0x7f : 0x8;
|
||||
t.c_cc[VERASE] = (config->erase_is_del) ? 0x7f : 0x8;
|
||||
#ifdef IUTF8
|
||||
t.c_iflag |= IUTF8;
|
||||
#endif
|
||||
|
@ -709,7 +709,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
|||
unsetenv("LINES");
|
||||
|
||||
/* pretend to be xterm */
|
||||
if (xterm_256color)
|
||||
if (config->xterm_256color)
|
||||
{
|
||||
putenv("TERM=xterm-256color");
|
||||
}
|
||||
|
@ -849,6 +849,13 @@ termpty_free(Termpty *ty)
|
|||
free(ty);
|
||||
}
|
||||
|
||||
void
|
||||
termpty_config_update(Termpty *ty, Config *config)
|
||||
{
|
||||
ty->config = config;
|
||||
termpty_backlog_size_set(ty, config->scrollback);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_termpty_cell_is_empty(const Termcell *cell)
|
||||
{
|
||||
|
@ -1734,12 +1741,6 @@ termpty_cell_codepoint_att_fill(Termpty *ty, Eina_Unicode codepoint,
|
|||
}
|
||||
}
|
||||
|
||||
Config *
|
||||
termpty_config_get(const Termpty *ty)
|
||||
{
|
||||
return termio_config_get(ty->obj);
|
||||
}
|
||||
|
||||
/* 0 means error here */
|
||||
static uint16_t
|
||||
_find_empty_slot(const Termpty *ty)
|
||||
|
|
|
@ -131,6 +131,7 @@ typedef struct _Term_Cursor {
|
|||
struct _Termpty
|
||||
{
|
||||
Evas_Object *obj;
|
||||
Config *config;
|
||||
Ecore_Event_Handler *hand_exe_exit;
|
||||
Ecore_Fd_Handler *hand_fd;
|
||||
struct {
|
||||
|
@ -273,10 +274,10 @@ void termpty_init(void);
|
|||
void termpty_shutdown(void);
|
||||
|
||||
Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||
int w, int h, int backscroll, Eina_Bool xterm_256color,
|
||||
Eina_Bool erase_is_del, const char *emotion_mod,
|
||||
const char *title, Ecore_Window window_id);
|
||||
int w, int h, Config *config, const char *emotion_mod,
|
||||
const char *title, Ecore_Window window_id);
|
||||
void termpty_free(Termpty *ty);
|
||||
void termpty_config_update(Termpty *ty, Config *config);
|
||||
|
||||
void termpty_backlog_lock(void);
|
||||
void termpty_backlog_unlock(void);
|
||||
|
@ -307,7 +308,6 @@ void termpty_screen_swap(Termpty *ty);
|
|||
|
||||
ssize_t termpty_line_length(const Termcell *cells, ssize_t nb_cells);
|
||||
|
||||
Config *termpty_config_get(const Termpty *ty);
|
||||
void termpty_handle_buf(Termpty *ty, const Eina_Unicode *codepoints, int len);
|
||||
void termpty_handle_block_codepoint_overwrite_heavy(Termpty *ty, int oldc, int newc);
|
||||
|
||||
|
|
|
@ -250,9 +250,10 @@ termpty_color_class_get(Termpty *ty EINA_UNUSED, const char *key,
|
|||
|
||||
|
||||
static void
|
||||
_termpty_init(Termpty *ty)
|
||||
_termpty_init(Termpty *ty, Config *config)
|
||||
{
|
||||
memset(ty, '\0', sizeof(*ty));
|
||||
ty->config = config;
|
||||
ty->w = TY_W;
|
||||
ty->h = TY_H;
|
||||
ty->backsize = TY_BACKSIZE;
|
||||
|
@ -312,7 +313,7 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
_config = config_new();
|
||||
_sd.config = _config;
|
||||
|
||||
_termpty_init(&_ty);
|
||||
_termpty_init(&_ty, _config);
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue