diff --git a/src/bin/main.c b/src/bin/main.c index 2875c5ae..c277ae41 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -98,7 +98,7 @@ main_ipc_new(Ipc_Instance *inst) } if (inst->title) { - nargv[i++] = "-t"; + nargv[i++] = "-T"; nargv[i++] = (char *)inst->title; } if (inst->font) @@ -636,10 +636,11 @@ elm_main(int argc, char **argv) { Eina_Strbuf *strb; strb = eina_strbuf_new(); - for(i = args; i < argc; i++) + eina_strbuf_append(strb, argv[args]); + for(i = args+1; i < argc -1; i++) { - eina_strbuf_append(strb, argv[i]); eina_strbuf_append_char(strb, ' '); + eina_strbuf_append(strb, argv[i]); } cmd = eina_strbuf_string_steal(strb); eina_strbuf_free(strb); diff --git a/src/bin/termio.c b/src/bin/termio.c index 6c49100a..2a12a022 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -371,12 +371,18 @@ void termio_user_title_set(Evas_Object *obj, const char *title) { Termio *sd = evas_object_smart_data_get(obj); + size_t len; EINA_SAFETY_ON_NULL_RETURN(sd); if (sd->pty->prop.user_title) eina_stringshare_del(sd->pty->prop.user_title); + sd->pty->prop.user_title = NULL; - sd->pty->prop.user_title = eina_stringshare_add(title); + len = strlen(title); + if (len) + { + sd->pty->prop.user_title = eina_stringshare_add_length(title, len); + } if (sd->pty->cb.set_title.func) sd->pty->cb.set_title.func(sd->pty->cb.set_title.data); } @@ -2494,6 +2500,7 @@ _sel_line(Termio *sd, int cy) sd->pty->selection.end.x = sd->grid.w - 1; sd->pty->selection.end.y = cy; + /* check lines above */ y = cy; for (;;) { @@ -2505,6 +2512,7 @@ _sel_line(Termio *sd, int cy) sd->pty->selection.start.y = y; y = cy; + /* check lines below */ for (;;) { cells = termpty_cellrow_get(sd->pty, y, &w); diff --git a/src/bin/termpty.c b/src/bin/termpty.c index 7a355c01..1efc594b 100644 --- a/src/bin/termpty.c +++ b/src/bin/termpty.c @@ -879,7 +879,7 @@ void termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max) { Termsave *ts; - ssize_t w; + ssize_t w, i; if (ty->backsize <= 0) return; @@ -889,6 +889,10 @@ termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max) termpty_backlog_lock(); w = termpty_line_length(cells, w_max); + for (i = 0; i < w - 1; i++) + { + cells[i].att.autowrapped = 1; + } if (ty->backsize >= 1) { ts = BACKLOG_ROW_GET(ty, 1); @@ -1015,6 +1019,7 @@ termpty_backscroll_adjust(Termpty *ty, int *scroll) } } +/* @requested_y unit is in visual lines on the screen */ static Termcell* _termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, ssize_t *wret) { @@ -1059,8 +1064,8 @@ _termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, ssize_t *wret) /* found the line */ int delta = screen_y - requested_y; *wret = ts->w - delta * ty->w; - if (*wret > ts->w) - *wret = ts->w; + if (*wret > ty->w) + *wret = ty->w; return &ts->cells[delta * ty->w]; } backlog_y++; @@ -1085,8 +1090,8 @@ _termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, ssize_t *wret) /* found the line */ int delta = screen_y - requested_y; *wret = ts->w - delta * ty->w; - if (*wret > ts->w) - *wret = ts->w; + if (*wret > ty->w) + *wret = ty->w; return &ts->cells[delta * ty->w]; } screen_y -= nb_lines; @@ -1096,6 +1101,7 @@ _termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, ssize_t *wret) return NULL; } +/* @requested_y unit is in visual lines on the screen */ Termcell * termpty_cellrow_get(Termpty *ty, int y_requested, ssize_t *wret) { @@ -1110,7 +1116,6 @@ termpty_cellrow_get(Termpty *ty, int y_requested, ssize_t *wret) return NULL; return _termpty_cellrow_from_beacon_get(ty, y_requested, wret); - } void @@ -1182,7 +1187,6 @@ _termpty_line_rewrap(Termpty *ty, Termcell *src_cells, int len, } autowrapped = src_cells[len-1].att.autowrapped; - src_cells[len-1].att.autowrapped = 0; while (len > 0) { @@ -1290,8 +1294,6 @@ termpty_resize(Termpty *ty, int new_w, int new_h) *new_cells; int len; - ts->cells[ts->w - 1].att.autowrapped = 0; - len = termpty_line_length(cells, old_w); new_cells = malloc((ts->w + len) * sizeof(Termcell)); diff --git a/src/bin/termpty.h b/src/bin/termpty.h index 64ad99a4..5ef8f933 100644 --- a/src/bin/termpty.h +++ b/src/bin/termpty.h @@ -267,8 +267,6 @@ extern int _termpty_log_dom; #define TERMPTY_SCREEN(Tpty, X, Y) \ Tpty->screen[X + (((Y + Tpty->circular_offset) % Tpty->h) * Tpty->w)] -#define TERMPTY_FMTCLR(Tatt) \ - (Tatt).autowrapped = (Tatt).newline = 0 #define TERMPTY_RESTRICT_FIELD(Field, Min, Max) \ do { \ diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c index ba7bbf19..6d3c00ae 100644 --- a/src/bin/termptyops.c +++ b/src/bin/termptyops.c @@ -226,7 +226,7 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len) cells[ty->cursor_state.cx].att.dblwidth = _termpty_is_dblwidth_get(ty, g); if (EINA_UNLIKELY((cells[ty->cursor_state.cx].att.dblwidth) && (ty->cursor_state.cx < (max_right - 1)))) { - TERMPTY_FMTCLR(cells[ty->cursor_state.cx].att); + cells[ty->cursor_state.cx].att.newline = 0; termpty_cell_codepoint_att_fill(ty, 0, cells[ty->cursor_state.cx].att, &(cells[ty->cursor_state.cx + 1]), 1); } diff --git a/src/bin/termptysave.c b/src/bin/termptysave.c index 09b5da2f..0187af1c 100644 --- a/src/bin/termptysave.c +++ b/src/bin/termptysave.c @@ -119,7 +119,7 @@ termpty_save_expand(Termsave *ts, Termcell *cells, size_t delta) newcells = realloc(ts->cells, (ts->w + delta) * sizeof(Termcell)); if (!newcells) return NULL; - newcells[ts->w - 1].att.autowrapped = 0; + memcpy(&newcells[ts->w], cells, delta * sizeof(Termcell)); ts->w += delta; ts->cells = newcells; diff --git a/src/bin/win.c b/src/bin/win.c index 1dbc2e0d..c2c2bfde 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -161,6 +161,7 @@ struct _Win Ecore_Timer *cmdbox_focus_timer; unsigned char focused : 1; unsigned char cmdbox_up : 1; + unsigned char forced_title : 1; }; /* }}} */ @@ -1003,6 +1004,9 @@ _win_set_title(Term_Container *tc, wn = (Win*) tc; + if (wn->forced_title) + return; + eina_stringshare_del(tc->title); tc->title = eina_stringshare_ref(title); @@ -1138,10 +1142,12 @@ win_new(const char *name, const char *role, const char *title, tc->bell = _win_bell; tc->close = _win_close; tc->update = _win_update; - tc->title = eina_stringshare_add("Terminology"); + tc->title = eina_stringshare_add(title? title : "Terminology"); tc->type = TERM_CONTAINER_TYPE_WIN; tc->wn = wn; + wn->forced_title = (title != NULL); + config_default_font_set(config, evas_object_evas_get(wn->win)); wn->config = config_fork(config);