reduce scope of variables
This commit is contained in:
parent
3172c2cf30
commit
0b48853597
|
@ -58,7 +58,6 @@ about_show(Evas_Object *win, Evas_Object *base, Evas_Object *term,
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
About_Ctx *ctx;
|
About_Ctx *ctx;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = termio_config_get(term);
|
||||||
char buf[PATH_MAX];
|
|
||||||
const char *txt;
|
const char *txt;
|
||||||
|
|
||||||
ctx = malloc(sizeof(*ctx));
|
ctx = malloc(sizeof(*ctx));
|
||||||
|
@ -74,6 +73,8 @@ about_show(Evas_Object *win, Evas_Object *base, Evas_Object *term,
|
||||||
if (elm_layout_file_set(o, config_theme_path_get(config),
|
if (elm_layout_file_set(o, config_theme_path_get(config),
|
||||||
"terminology/about") == 0)
|
"terminology/about") == 0)
|
||||||
{
|
{
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/themes/default.edj",
|
snprintf(buf, sizeof(buf), "%s/themes/default.edj",
|
||||||
elm_app_data_dir_get());
|
elm_app_data_dir_get());
|
||||||
elm_layout_file_set(o, buf, "terminology/about");
|
elm_layout_file_set(o, buf, "terminology/about");
|
||||||
|
|
|
@ -385,14 +385,14 @@ colors_term_init(Evas_Object *textgrid,
|
||||||
const Evas_Object *bg,
|
const Evas_Object *bg,
|
||||||
const Config *config)
|
const Config *config)
|
||||||
{
|
{
|
||||||
int c, n;
|
int c;
|
||||||
char buf[32];
|
char buf[32];
|
||||||
int r, g , b, a;
|
int r, g , b, a;
|
||||||
const Color *color;
|
const Color *color;
|
||||||
|
|
||||||
for (c = 0; c < (4 * 12); c++)
|
for (c = 0; c < (4 * 12); c++)
|
||||||
{
|
{
|
||||||
n = c + (24 * (c / 24));
|
int n = c + (24 * (c / 24));
|
||||||
if (config->colors_use)
|
if (config->colors_use)
|
||||||
{
|
{
|
||||||
r = config->colors[c].r;
|
r = config->colors[c].r;
|
||||||
|
|
|
@ -48,8 +48,7 @@ _ipc_hash_get(void)
|
||||||
const char *disp, *session, *xdg_session, *xdg_id, *xdg_seat, *xdg_vt;
|
const char *disp, *session, *xdg_session, *xdg_id, *xdg_seat, *xdg_vt;
|
||||||
char *s;
|
char *s;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned char c1, c2;
|
|
||||||
|
|
||||||
/* dumb stoopid hash - i'm feeling lazy */
|
/* dumb stoopid hash - i'm feeling lazy */
|
||||||
disp = getenv("DISPLAY");
|
disp = getenv("DISPLAY");
|
||||||
if (!disp) disp = "-unknown-";
|
if (!disp) disp = "-unknown-";
|
||||||
|
@ -70,6 +69,8 @@ _ipc_hash_get(void)
|
||||||
memset(hash+12, 'x', 32);
|
memset(hash+12, 'x', 32);
|
||||||
for (i = 0, s = buf; *s; s++)
|
for (i = 0, s = buf; *s; s++)
|
||||||
{
|
{
|
||||||
|
unsigned char c1, c2;
|
||||||
|
|
||||||
c1 = (((unsigned char)*s) >> 4) & 0xf;
|
c1 = (((unsigned char)*s) >> 4) & 0xf;
|
||||||
c2 = ((unsigned char)*s) & 0x0f;
|
c2 = ((unsigned char)*s) & 0x0f;
|
||||||
hash[12 + (i % 32)] = (((hash[12 + (i % 32)] - 'a') ^ c1) % 26) + 'a';
|
hash[12 + (i % 32)] = (((hash[12 + (i % 32)] - 'a') ^ c1) % 26) + 'a';
|
||||||
|
|
|
@ -382,11 +382,9 @@ cb_term_right(Evas_Object *termio_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
cb_term_new(Evas_Object *termio_obj)
|
cb_term_new(Evas_Object *termio_obj)
|
||||||
{
|
{
|
||||||
RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
|
char path[PATH_MAX], cwd[PATH_MAX];
|
||||||
|
|
||||||
char path[PATH_MAX], cwd[PATH_MAX], *cmd;
|
RETURN_FALSE_ON_GROUP_ACTION_ALREADY_HANDLED;
|
||||||
const char *template = "%s -d %s";
|
|
||||||
int length;
|
|
||||||
|
|
||||||
#if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 16)
|
#if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 16)
|
||||||
eina_file_path_join(path, sizeof(path), elm_app_bin_dir_get(),
|
eina_file_path_join(path, sizeof(path), elm_app_bin_dir_get(),
|
||||||
|
@ -397,6 +395,10 @@ cb_term_new(Evas_Object *termio_obj)
|
||||||
#endif
|
#endif
|
||||||
if (termio_cwd_get(termio_obj, cwd, sizeof(cwd)))
|
if (termio_cwd_get(termio_obj, cwd, sizeof(cwd)))
|
||||||
{
|
{
|
||||||
|
const char *template = "%s -d %s";
|
||||||
|
int length;
|
||||||
|
char *cmd;
|
||||||
|
|
||||||
length = (strlen(path) + strlen(cwd) + strlen(template) - 3);
|
length = (strlen(path) + strlen(cwd) + strlen(template) - 3);
|
||||||
cmd = malloc(sizeof(char) * length);
|
cmd = malloc(sizeof(char) * length);
|
||||||
snprintf(cmd, length, template, path, cwd);
|
snprintf(cmd, length, template, path, cwd);
|
||||||
|
|
|
@ -32,9 +32,8 @@ void byteReverse(unsigned char *buf, unsigned longs);
|
||||||
*/
|
*/
|
||||||
void byteReverse(unsigned char *buf, unsigned longs)
|
void byteReverse(unsigned char *buf, unsigned longs)
|
||||||
{
|
{
|
||||||
uint32_t t;
|
|
||||||
do {
|
do {
|
||||||
t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
uint32_t t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
||||||
((unsigned) buf[1] << 8 | buf[0]);
|
((unsigned) buf[1] << 8 | buf[0]);
|
||||||
*(uint32_t *) buf = t;
|
*(uint32_t *) buf = t;
|
||||||
buf += 4;
|
buf += 4;
|
||||||
|
|
|
@ -54,14 +54,17 @@ static Evas_Smart_Class _parent_sc = EVAS_SMART_CLASS_INIT_NULL;
|
||||||
static const char *
|
static const char *
|
||||||
_is_fmt(const char *f, const char **extn)
|
_is_fmt(const char *f, const char **extn)
|
||||||
{
|
{
|
||||||
int i, len, l;
|
int i;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
len = strlen(f);
|
len = strlen(f);
|
||||||
for (i = 0; extn[i]; i++)
|
for (i = 0; extn[i]; i++)
|
||||||
{
|
{
|
||||||
l = strlen(extn[i]);
|
size_t l = strlen(extn[i]);
|
||||||
if (len < l) continue;
|
if (len < l)
|
||||||
if (!strcasecmp(extn[i], f + len - l)) return extn[i];
|
continue;
|
||||||
|
if (!strcasecmp(extn[i], f + len - l))
|
||||||
|
return extn[i];
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -472,7 +475,6 @@ _type_scale_init(Evas_Object *obj)
|
||||||
static void
|
static void
|
||||||
_type_scale_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
_type_scale_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
|
||||||
Media *sd = evas_object_smart_data_get(obj);
|
Media *sd = evas_object_smart_data_get(obj);
|
||||||
if (!sd) return;
|
if (!sd) return;
|
||||||
if ((w <= 0) || (h <= 0) || (sd->iw <= 0) || (sd->ih <= 0))
|
if ((w <= 0) || (h <= 0) || (sd->iw <= 0) || (sd->ih <= 0))
|
||||||
|
@ -526,6 +528,8 @@ _type_scale_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Eva
|
||||||
if (lh < 256) lh = 256;
|
if (lh < 256) lh = 256;
|
||||||
if ((lw != sd->sw) || (lh != sd->sh))
|
if ((lw != sd->sw) || (lh != sd->sh))
|
||||||
{
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
|
||||||
o = sd->o_tmp = evas_object_image_filled_add(evas_object_evas_get(obj));
|
o = sd->o_tmp = evas_object_image_filled_add(evas_object_evas_get(obj));
|
||||||
evas_object_smart_member_add(o, obj);
|
evas_object_smart_member_add(o, obj);
|
||||||
evas_object_clip_set(o, sd->clip);
|
evas_object_clip_set(o, sd->clip);
|
||||||
|
|
|
@ -213,7 +213,6 @@ void
|
||||||
miniview_position_offset(const Evas_Object *obj, int by, Eina_Bool sanitize)
|
miniview_position_offset(const Evas_Object *obj, int by, Eina_Bool sanitize)
|
||||||
{
|
{
|
||||||
Miniview *mv = evas_object_smart_data_get(obj);
|
Miniview *mv = evas_object_smart_data_get(obj);
|
||||||
int remain = 0;
|
|
||||||
|
|
||||||
termio_scroll_get(mv->termio);
|
termio_scroll_get(mv->termio);
|
||||||
EINA_SAFETY_ON_NULL_RETURN(mv);
|
EINA_SAFETY_ON_NULL_RETURN(mv);
|
||||||
|
@ -222,6 +221,8 @@ miniview_position_offset(const Evas_Object *obj, int by, Eina_Bool sanitize)
|
||||||
|
|
||||||
if (!mv->fits_to_img)
|
if (!mv->fits_to_img)
|
||||||
{
|
{
|
||||||
|
int remain;
|
||||||
|
|
||||||
mv->screen.pos_val += (double) by / (mv->img_h - mv->rows);
|
mv->screen.pos_val += (double) by / (mv->img_h - mv->rows);
|
||||||
edje_object_part_drag_value_set(mv->base, "miniview_screen",
|
edje_object_part_drag_value_set(mv->base, "miniview_screen",
|
||||||
0.0, mv->screen.pos_val);
|
0.0, mv->screen.pos_val);
|
||||||
|
@ -517,7 +518,6 @@ _deferred_renderer(void *data)
|
||||||
int history_len, pos;
|
int history_len, pos;
|
||||||
ssize_t wret;
|
ssize_t wret;
|
||||||
unsigned int *pixels, y;
|
unsigned int *pixels, y;
|
||||||
Termcell *cells;
|
|
||||||
Termpty *ty;
|
Termpty *ty;
|
||||||
unsigned int colors[512];
|
unsigned int colors[512];
|
||||||
double bottom_bound;
|
double bottom_bound;
|
||||||
|
@ -555,8 +555,10 @@ _deferred_renderer(void *data)
|
||||||
|
|
||||||
for (y = 0; y < mv->img_h; y++)
|
for (y = 0; y < mv->img_h; y++)
|
||||||
{
|
{
|
||||||
cells = termpty_cellrow_get(ty, mv->img_hist + y, &wret);
|
Termcell *cells = termpty_cellrow_get(ty, mv->img_hist + y, &wret);
|
||||||
if (!cells) break;
|
|
||||||
|
if (!cells)
|
||||||
|
break;
|
||||||
_draw_line(ty, &pixels[y * mv->cols], cells, wret, colors);
|
_draw_line(ty, &pixels[y * mv->cols], cells, wret, colors);
|
||||||
}
|
}
|
||||||
evas_object_image_data_set(mv->img, pixels);
|
evas_object_image_data_set(mv->img, pixels);
|
||||||
|
|
|
@ -173,43 +173,44 @@ _grid_content_get(void *data, Evas_Object *obj, const char *part)
|
||||||
Background_Ctx *ctx = evas_object_data_get(obj, "ctx");
|
Background_Ctx *ctx = evas_object_data_get(obj, "ctx");
|
||||||
assert(ctx);
|
assert(ctx);
|
||||||
Background_Item *item = data;
|
Background_Item *item = data;
|
||||||
Evas_Object *o, *oe;
|
|
||||||
Config *config = ctx->config;
|
Config *config = ctx->config;
|
||||||
char path[PATH_MAX];
|
|
||||||
|
|
||||||
if (!strcmp(part, "elm.swallow.icon"))
|
if (strcmp(part, "elm.swallow.icon"))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (item->path)
|
||||||
{
|
{
|
||||||
if (item->path)
|
int i;
|
||||||
|
Media_Type type;
|
||||||
|
for (i = 0; extn_edj[i]; i++)
|
||||||
{
|
{
|
||||||
int i;
|
if (eina_str_has_extension(item->path, extn_edj[i]))
|
||||||
Media_Type type;
|
return media_add(obj, item->path, config,
|
||||||
for (i = 0; extn_edj[i]; i++)
|
MEDIA_BG, MEDIA_TYPE_EDJE);
|
||||||
{
|
|
||||||
if (eina_str_has_extension(item->path, extn_edj[i]))
|
|
||||||
return media_add(obj, item->path, config,
|
|
||||||
MEDIA_BG, MEDIA_TYPE_EDJE);
|
|
||||||
}
|
|
||||||
type = media_src_type_get(item->path);
|
|
||||||
return media_add(obj, item->path, config, MEDIA_THUMB, type);
|
|
||||||
}
|
}
|
||||||
else
|
type = media_src_type_get(item->path);
|
||||||
{
|
return media_add(obj, item->path, config, MEDIA_THUMB, type);
|
||||||
if (!config->theme)
|
|
||||||
return NULL;
|
|
||||||
snprintf(path, PATH_MAX, "%s/themes/%s", elm_app_data_dir_get(),
|
|
||||||
config->theme);
|
|
||||||
o = elm_layout_add(obj);
|
|
||||||
oe = elm_layout_edje_get(o);
|
|
||||||
if (!edje_object_file_set(oe, path, "terminology/background"))
|
|
||||||
{
|
|
||||||
evas_object_del(o);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
evas_object_show(o);
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return NULL;
|
else
|
||||||
|
{
|
||||||
|
Evas_Object *o, *oe;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
|
||||||
|
if (!config->theme)
|
||||||
|
return NULL;
|
||||||
|
snprintf(path, PATH_MAX, "%s/themes/%s", elm_app_data_dir_get(),
|
||||||
|
config->theme);
|
||||||
|
o = elm_layout_add(obj);
|
||||||
|
oe = elm_layout_edje_get(o);
|
||||||
|
if (!edje_object_file_set(oe, path, "terminology/background"))
|
||||||
|
{
|
||||||
|
evas_object_del(o);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
evas_object_show(o);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
return NULL; /* unreached */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -389,7 +390,6 @@ _cb_entry_changed(void *data,
|
||||||
static void
|
static void
|
||||||
_cb_hoversel_select(Background_Ctx *ctx, const Eina_Stringshare *path)
|
_cb_hoversel_select(Background_Ctx *ctx, const Eina_Stringshare *path)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
elm_flip_go_to(ctx->flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT);
|
elm_flip_go_to(ctx->flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT);
|
||||||
|
@ -397,7 +397,7 @@ _cb_hoversel_select(Background_Ctx *ctx, const Eina_Stringshare *path)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
o = elm_object_part_content_get(ctx->flip, "back");
|
Evas_Object *o = elm_object_part_content_get(ctx->flip, "back");
|
||||||
elm_fileselector_path_set(o, elm_object_text_get(ctx->entry));
|
elm_fileselector_path_set(o, elm_object_text_get(ctx->entry));
|
||||||
elm_flip_go_to(ctx->flip, EINA_FALSE, ELM_FLIP_PAGE_RIGHT);
|
elm_flip_go_to(ctx->flip, EINA_FALSE, ELM_FLIP_PAGE_RIGHT);
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ options_background(Evas_Object *opbox, Evas_Object *term)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *bx, *bx_front;
|
Evas_Object *o, *bx, *bx_front;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = termio_config_get(term);
|
||||||
char path[PATH_MAX], *config_background_dir;
|
char path[PATH_MAX];
|
||||||
Background_Ctx *ctx;
|
Background_Ctx *ctx;
|
||||||
|
|
||||||
ctx = calloc(1, sizeof(*ctx));
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
|
@ -706,6 +706,7 @@ options_background(Evas_Object *opbox, Evas_Object *term)
|
||||||
|
|
||||||
if (config->background)
|
if (config->background)
|
||||||
{
|
{
|
||||||
|
char *config_background_dir;
|
||||||
config_background_dir = ecore_file_dir_get(config->background);
|
config_background_dir = ecore_file_dir_get(config->background);
|
||||||
elm_object_text_set(ctx->entry, config_background_dir);
|
elm_object_text_set(ctx->entry, config_background_dir);
|
||||||
free(config_background_dir);
|
free(config_background_dir);
|
||||||
|
|
|
@ -236,7 +236,6 @@ _cb_op_font_preview_delayed_eval(void *data)
|
||||||
goto done;
|
goto done;
|
||||||
if (ELM_RECTS_INTERSECT(ox, oy, ow, oh, vx, vy, vw, vh))
|
if (ELM_RECTS_INTERSECT(ox, oy, ow, oh, vx, vy, vw, vh))
|
||||||
{
|
{
|
||||||
char buf[4096];
|
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
Evas *evas = evas_object_evas_get(obj);
|
Evas *evas = evas_object_evas_get(obj);
|
||||||
Evas_Object *textgrid = termio_textgrid_get(f->ctx->term);
|
Evas_Object *textgrid = termio_textgrid_get(f->ctx->term);
|
||||||
|
@ -250,6 +249,7 @@ _cb_op_font_preview_delayed_eval(void *data)
|
||||||
evas_object_scale_set(o, elm_config_scale_get());
|
evas_object_scale_set(o, elm_config_scale_get());
|
||||||
if (f->bitmap)
|
if (f->bitmap)
|
||||||
{
|
{
|
||||||
|
char buf[4096];
|
||||||
snprintf(buf, sizeof(buf), "%s/fonts/%s",
|
snprintf(buf, sizeof(buf), "%s/fonts/%s",
|
||||||
elm_app_data_dir_get(), f->full_name);
|
elm_app_data_dir_get(), f->full_name);
|
||||||
evas_object_text_font_set(o, buf, config->font.size);
|
evas_object_text_font_set(o, buf, config->font.size);
|
||||||
|
|
|
@ -51,11 +51,12 @@ _cb_op_theme_content_get(void *data, Evas_Object *obj, const char *part)
|
||||||
|
|
||||||
if (!strcmp(part, "elm.swallow.icon"))
|
if (!strcmp(part, "elm.swallow.icon"))
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
|
||||||
Config *config = t->ctx->config;
|
Config *config = t->ctx->config;
|
||||||
|
|
||||||
if (config)
|
if (config)
|
||||||
{
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
|
||||||
o = options_theme_preview_add(obj, config,
|
o = options_theme_preview_add(obj, config,
|
||||||
theme_path_get(t->name),
|
theme_path_get(t->name),
|
||||||
128 * elm_config_scale_get(),
|
128 * elm_config_scale_get(),
|
||||||
|
|
|
@ -80,7 +80,6 @@ ty_sb_spaces_rtrim(struct ty_sb *sb)
|
||||||
char *
|
char *
|
||||||
ty_sb_steal_buf(struct ty_sb *sb)
|
ty_sb_steal_buf(struct ty_sb *sb)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (!sb->len)
|
if (!sb->len)
|
||||||
|
@ -88,6 +87,8 @@ ty_sb_steal_buf(struct ty_sb *sb)
|
||||||
|
|
||||||
if (sb->gap != 0)
|
if (sb->gap != 0)
|
||||||
{
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
sb->buf -= sb->gap;
|
sb->buf -= sb->gap;
|
||||||
for (i = 0; i <= sb->len; i++)
|
for (i = 0; i <= sb->len; i++)
|
||||||
{
|
{
|
||||||
|
|
214
src/bin/termio.c
214
src/bin/termio.c
|
@ -401,7 +401,6 @@ termio_config_update(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
Termio *sd = evas_object_smart_data_get(obj);
|
Termio *sd = evas_object_smart_data_get(obj);
|
||||||
Evas_Coord w, h, ow = 0, oh = 0;
|
Evas_Coord w, h, ow = 0, oh = 0;
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
|
|
||||||
|
@ -410,6 +409,8 @@ termio_config_update(Evas_Object *obj)
|
||||||
|
|
||||||
if (sd->config->font.bitmap)
|
if (sd->config->font.bitmap)
|
||||||
{
|
{
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/fonts/%s",
|
snprintf(buf, sizeof(buf), "%s/fonts/%s",
|
||||||
elm_app_data_dir_get(), sd->config->font.name);
|
elm_app_data_dir_get(), sd->config->font.name);
|
||||||
sd->font.name = eina_stringshare_add(buf);
|
sd->font.name = eina_stringshare_add(buf);
|
||||||
|
@ -931,7 +932,6 @@ _cb_ctxp_link_content_copy(void *data,
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Evas_Object *term = data;
|
||||||
Termio *sd = evas_object_smart_data_get(term);
|
Termio *sd = evas_object_smart_data_get(term);
|
||||||
const char *raw_link;
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
|
|
||||||
if (sd->link.id)
|
if (sd->link.id)
|
||||||
|
@ -945,6 +945,8 @@ _cb_ctxp_link_content_copy(void *data,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct ty_sb sb = {.buf = NULL, .len = 0, .alloc = 0};
|
struct ty_sb sb = {.buf = NULL, .len = 0, .alloc = 0};
|
||||||
|
const char *raw_link;
|
||||||
|
|
||||||
termio_selection_get(sd,
|
termio_selection_get(sd,
|
||||||
sd->link.x1, sd->link.y1,
|
sd->link.x1, sd->link.y1,
|
||||||
sd->link.x2, sd->link.y2,
|
sd->link.x2, sd->link.y2,
|
||||||
|
@ -1479,7 +1481,6 @@ _hyperlink_mouseover(Termio *sd,
|
||||||
uint16_t link_id)
|
uint16_t link_id)
|
||||||
{
|
{
|
||||||
Evas_Coord ox, oy, ow, oh;
|
Evas_Coord ox, oy, ow, oh;
|
||||||
Evas_Object *o;
|
|
||||||
int x, y;
|
int x, y;
|
||||||
Term_Link *hl;
|
Term_Link *hl;
|
||||||
|
|
||||||
|
@ -1506,8 +1507,9 @@ _hyperlink_mouseover(Termio *sd,
|
||||||
termpty_backscroll_adjust(sd->pty, &sd->scroll);
|
termpty_backscroll_adjust(sd->pty, &sd->scroll);
|
||||||
for (y = 0; y < sd->grid.h; y++)
|
for (y = 0; y < sd->grid.h; y++)
|
||||||
{
|
{
|
||||||
ssize_t w = 0;
|
|
||||||
Termcell *cells;
|
Termcell *cells;
|
||||||
|
Evas_Object *o;
|
||||||
|
ssize_t w = 0;
|
||||||
int start_x = -1;
|
int start_x = -1;
|
||||||
Eina_Bool add_tooltip = EINA_FALSE;
|
Eina_Bool add_tooltip = EINA_FALSE;
|
||||||
|
|
||||||
|
@ -1607,11 +1609,13 @@ _smart_media_clicked(void *data, Evas_Object *obj, void *_info EINA_UNUSED)
|
||||||
cmd = config->helper.local.general;
|
cmd = config->helper.local.general;
|
||||||
if (cmd)
|
if (cmd)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX], *escaped;
|
char *escaped;
|
||||||
|
|
||||||
escaped = ecore_file_escape_name(file);
|
escaped = ecore_file_escape_name(file);
|
||||||
if (escaped)
|
if (escaped)
|
||||||
{
|
{
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
|
snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
|
||||||
ecore_exe_run(buf, NULL);
|
ecore_exe_run(buf, NULL);
|
||||||
free(escaped);
|
free(escaped);
|
||||||
|
@ -1896,7 +1900,6 @@ static void
|
||||||
_block_edje_cmds(Termpty *ty, Termblock *blk, Eina_List *cmds, Eina_Bool created)
|
_block_edje_cmds(Termpty *ty, Termblock *blk, Eina_List *cmds, Eina_Bool created)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
char *s;
|
|
||||||
|
|
||||||
#define ISCMD(cmd) !strcmp(s, cmd)
|
#define ISCMD(cmd) !strcmp(s, cmd)
|
||||||
#define GETS(var) l = l->next; if (!l) return; var = l->data
|
#define GETS(var) l = l->next; if (!l) return; var = l->data
|
||||||
|
@ -1905,7 +1908,7 @@ _block_edje_cmds(Termpty *ty, Termblock *blk, Eina_List *cmds, Eina_Bool created
|
||||||
l = cmds;
|
l = cmds;
|
||||||
while (l)
|
while (l)
|
||||||
{
|
{
|
||||||
s = l->data;
|
char *s = l->data;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
if (ISCMD("text")) // set text part
|
if (ISCMD("text")) // set text part
|
||||||
|
@ -3522,6 +3525,7 @@ _smart_pty_command(void *data)
|
||||||
char *pp;
|
char *pp;
|
||||||
int ww = 0, hh = 0, repch;
|
int ww = 0, hh = 0, repch;
|
||||||
Eina_List *strs = NULL;
|
Eina_List *strs = NULL;
|
||||||
|
char *link = NULL;
|
||||||
|
|
||||||
// exact size in CHAR CELLS - WW (decimal) width CELLS,
|
// exact size in CHAR CELLS - WW (decimal) width CELLS,
|
||||||
// HH (decimal) in CELLS.
|
// HH (decimal) in CELLS.
|
||||||
|
@ -3536,115 +3540,113 @@ _smart_pty_command(void *data)
|
||||||
// CMD is the command, P1, P2, P3 etc. are parameters (P2 and
|
// CMD is the command, P1, P2, P3 etc. are parameters (P2 and
|
||||||
// on are optional depending on CMD)
|
// on are optional depending on CMD)
|
||||||
repch = ty->cur_cmd[2];
|
repch = ty->cur_cmd[2];
|
||||||
if (repch)
|
if (!repch)
|
||||||
{
|
return;
|
||||||
char *link = NULL;
|
|
||||||
|
|
||||||
for (p0 = p = &(ty->cur_cmd[3]); *p; p++)
|
for (p0 = p = &(ty->cur_cmd[3]); *p; p++)
|
||||||
|
{
|
||||||
|
if (*p == ';')
|
||||||
{
|
{
|
||||||
if (*p == ';')
|
ww = strtol(p0, NULL, 10);
|
||||||
{
|
p++;
|
||||||
ww = strtol(p0, NULL, 10);
|
break;
|
||||||
p++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (p0 = p; *p; p++)
|
}
|
||||||
|
for (p0 = p; *p; p++)
|
||||||
|
{
|
||||||
|
if (*p == ';')
|
||||||
{
|
{
|
||||||
if (*p == ';')
|
hh = strtol(p0, NULL, 10);
|
||||||
{
|
p++;
|
||||||
hh = strtol(p0, NULL, 10);
|
break;
|
||||||
p++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (ty->cur_cmd[1] == 'j')
|
}
|
||||||
|
if (ty->cur_cmd[1] == 'j')
|
||||||
|
{
|
||||||
|
// parse from p until end of string - one newline
|
||||||
|
// per list item in strs
|
||||||
|
p0 = p1 = p;
|
||||||
|
for (;;)
|
||||||
{
|
{
|
||||||
// parse from p until end of string - one newline
|
// end of str param
|
||||||
// per list item in strs
|
if ((*p1 == '\n') || (*p1 == '\r') || (!*p1))
|
||||||
p0 = p1 = p;
|
|
||||||
for (;;)
|
|
||||||
{
|
{
|
||||||
// end of str param
|
// if string is non-empty...
|
||||||
if ((*p1 == '\n') || (*p1 == '\r') || (!*p1))
|
if ((p1 - p0) >= 1)
|
||||||
{
|
{
|
||||||
// if string is non-empty...
|
// allocate, fill and add to list
|
||||||
if ((p1 - p0) >= 1)
|
pp = malloc(p1 - p0 + 1);
|
||||||
|
if (pp)
|
||||||
{
|
{
|
||||||
// allocate, fill and add to list
|
strncpy(pp, p0, p1 - p0);
|
||||||
pp = malloc(p1 - p0 + 1);
|
pp[p1 - p0] = 0;
|
||||||
if (pp)
|
strs = eina_list_append(strs, pp);
|
||||||
{
|
|
||||||
strncpy(pp, p0, p1 - p0);
|
|
||||||
pp[p1 - p0] = 0;
|
|
||||||
strs = eina_list_append(strs, pp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// end of string buffer
|
|
||||||
if (!*p1) break;
|
|
||||||
p1++; // skip \n or \r
|
|
||||||
p0 = p1;
|
|
||||||
}
|
}
|
||||||
else
|
// end of string buffer
|
||||||
p1++;
|
if (!*p1) break;
|
||||||
|
p1++; // skip \n or \r
|
||||||
|
p0 = p1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p1++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path = p;
|
||||||
|
p = strchr(path, '\n');
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
link = strdup(path);
|
||||||
|
path = p + 1;
|
||||||
|
if (isspace(path[0])) path++;
|
||||||
|
pp = strchr(link, '\n');
|
||||||
|
if (pp) *pp = 0;
|
||||||
|
pp = strchr(link, '\r');
|
||||||
|
if (pp) *pp = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((ww < 512) && (hh < 512))
|
||||||
|
{
|
||||||
|
Termblock *blk = NULL;
|
||||||
|
|
||||||
|
if (strs)
|
||||||
|
{
|
||||||
|
const char *file, *group;
|
||||||
|
Eina_List *l;
|
||||||
|
|
||||||
|
file = eina_list_nth(strs, 0);
|
||||||
|
group = eina_list_nth(strs, 1);
|
||||||
|
l = eina_list_nth_list(strs, 2);
|
||||||
|
blk = termpty_block_new(ty, ww, hh, file, group);
|
||||||
|
for (;l; l = l->next)
|
||||||
|
{
|
||||||
|
pp = l->data;
|
||||||
|
if (pp)
|
||||||
|
blk->cmds = eina_list_append(blk->cmds, pp);
|
||||||
|
l->data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
blk = termpty_block_new(ty, ww, hh, path, link);
|
||||||
|
if (blk)
|
||||||
{
|
{
|
||||||
path = p;
|
if (ty->cur_cmd[1] == 's')
|
||||||
p = strchr(path, '\n');
|
blk->scale_stretch = EINA_TRUE;
|
||||||
if (p)
|
else if (ty->cur_cmd[1] == 'c')
|
||||||
{
|
blk->scale_center = EINA_TRUE;
|
||||||
link = strdup(path);
|
else if (ty->cur_cmd[1] == 'f')
|
||||||
path = p + 1;
|
blk->scale_fill = EINA_TRUE;
|
||||||
if (isspace(path[0])) path++;
|
else if (ty->cur_cmd[1] == 't')
|
||||||
pp = strchr(link, '\n');
|
blk->thumb = EINA_TRUE;
|
||||||
if (pp) *pp = 0;
|
else if (ty->cur_cmd[1] == 'j')
|
||||||
pp = strchr(link, '\r');
|
blk->edje = EINA_TRUE;
|
||||||
if (pp) *pp = 0;
|
termpty_block_insert(ty, repch, blk);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ((ww < 512) && (hh < 512))
|
|
||||||
{
|
|
||||||
Termblock *blk = NULL;
|
|
||||||
|
|
||||||
if (strs)
|
|
||||||
{
|
|
||||||
const char *file, *group;
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
file = eina_list_nth(strs, 0);
|
|
||||||
group = eina_list_nth(strs, 1);
|
|
||||||
l = eina_list_nth_list(strs, 2);
|
|
||||||
blk = termpty_block_new(ty, ww, hh, file, group);
|
|
||||||
for (;l; l = l->next)
|
|
||||||
{
|
|
||||||
pp = l->data;
|
|
||||||
if (pp)
|
|
||||||
blk->cmds = eina_list_append(blk->cmds, pp);
|
|
||||||
l->data = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
blk = termpty_block_new(ty, ww, hh, path, link);
|
|
||||||
if (blk)
|
|
||||||
{
|
|
||||||
if (ty->cur_cmd[1] == 's')
|
|
||||||
blk->scale_stretch = EINA_TRUE;
|
|
||||||
else if (ty->cur_cmd[1] == 'c')
|
|
||||||
blk->scale_center = EINA_TRUE;
|
|
||||||
else if (ty->cur_cmd[1] == 'f')
|
|
||||||
blk->scale_fill = EINA_TRUE;
|
|
||||||
else if (ty->cur_cmd[1] == 't')
|
|
||||||
blk->thumb = EINA_TRUE;
|
|
||||||
else if (ty->cur_cmd[1] == 'j')
|
|
||||||
blk->edje = EINA_TRUE;
|
|
||||||
termpty_block_insert(ty, repch, blk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(link);
|
|
||||||
EINA_LIST_FREE(strs, pp) free(pp);
|
|
||||||
}
|
}
|
||||||
|
free(link);
|
||||||
|
EINA_LIST_FREE(strs, pp) free(pp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (ty->cur_cmd[1] == 'C')
|
else if (ty->cur_cmd[1] == 'C')
|
||||||
|
@ -3718,27 +3720,25 @@ _smart_pty_command(void *data)
|
||||||
}
|
}
|
||||||
else if (ty->cur_cmd[1] == 'd') // data packet
|
else if (ty->cur_cmd[1] == 'd') // data packet
|
||||||
{
|
{
|
||||||
int pksum = atoi(&(ty->cur_cmd[2]));
|
|
||||||
int sum;
|
|
||||||
char *p = strchr(ty->cur_cmd, ' ');
|
char *p = strchr(ty->cur_cmd, ' ');
|
||||||
Eina_Bool valid = EINA_TRUE;
|
Eina_Bool valid = EINA_TRUE;
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
Eina_Binbuf *bb = eina_binbuf_new();
|
Eina_Binbuf *bb = eina_binbuf_new();
|
||||||
unsigned char v;
|
|
||||||
|
|
||||||
if (bb)
|
if (bb)
|
||||||
{
|
{
|
||||||
unsigned char localbuf[128];
|
unsigned char localbuf[128];
|
||||||
unsigned char localbufpos = 0;
|
unsigned char localbufpos = 0;
|
||||||
|
int pksum = atoi(&(ty->cur_cmd[2]));
|
||||||
|
int sum;
|
||||||
|
|
||||||
eina_binbuf_expand(bb, 32 * 1024);
|
eina_binbuf_expand(bb, 32 * 1024);
|
||||||
sum = 0;
|
|
||||||
for (sum = 0, p++; *p; p++)
|
for (sum = 0, p++; *p; p++)
|
||||||
{
|
{
|
||||||
// high nibble
|
// high nibble
|
||||||
v = (unsigned char)(*p);
|
unsigned char v = (unsigned char)(*p);
|
||||||
sum += v;
|
sum += v;
|
||||||
v = ((v - '@') & 0xf) << 4;
|
v = ((v - '@') & 0xf) << 4;
|
||||||
// low nibble
|
// low nibble
|
||||||
|
@ -3852,13 +3852,13 @@ _smart_cb_drop(void *data,
|
||||||
{
|
{
|
||||||
if (strchr(ev->data, '\n'))
|
if (strchr(ev->data, '\n'))
|
||||||
{
|
{
|
||||||
char *p, *p2, *p3, *tb;
|
char *tb = malloc(strlen(ev->data) + 1);
|
||||||
|
|
||||||
tb = malloc(strlen(ev->data) + 1);
|
|
||||||
if (tb)
|
if (tb)
|
||||||
{
|
{
|
||||||
|
char *p;
|
||||||
for (p = ev->data; p;)
|
for (p = ev->data; p;)
|
||||||
{
|
{
|
||||||
|
char *p2, *p3;
|
||||||
p2 = strchr(p, '\n');
|
p2 = strchr(p, '\n');
|
||||||
p3 = strchr(p, '\r');
|
p3 = strchr(p, '\r');
|
||||||
if (p2 && p3)
|
if (p2 && p3)
|
||||||
|
|
|
@ -2735,17 +2735,23 @@ termio_internal_render(Termio *sd,
|
||||||
preedit_str = term_preedit_str_get(sd->term);
|
preedit_str = term_preedit_str_get(sd->term);
|
||||||
if (preedit_str && preedit_str[0])
|
if (preedit_str && preedit_str[0])
|
||||||
{
|
{
|
||||||
Eina_Unicode *uni, g;
|
Eina_Unicode *uni;
|
||||||
int len = 0, i, jump, xx, backx;
|
int len = 0;
|
||||||
Eina_Bool dbl;
|
|
||||||
Evas_Textgrid_Cell *tc;
|
|
||||||
x = sd->cursor.x, y = sd->cursor.y;
|
x = sd->cursor.x, y = sd->cursor.y;
|
||||||
|
|
||||||
uni = eina_unicode_utf8_to_unicode(preedit_str, &len);
|
uni = eina_unicode_utf8_to_unicode(preedit_str, &len);
|
||||||
if (uni)
|
if (uni)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
|
int backx;
|
||||||
|
int xx;
|
||||||
|
int jump;
|
||||||
|
Eina_Bool dbl;
|
||||||
|
Evas_Textgrid_Cell *tc;
|
||||||
|
Eina_Unicode g;
|
||||||
|
|
||||||
jump = 1;
|
jump = 1;
|
||||||
g = uni[i];
|
g = uni[i];
|
||||||
dbl = _termpty_is_dblwidth_get(sd->pty, g);
|
dbl = _termpty_is_dblwidth_get(sd->pty, g);
|
||||||
|
|
|
@ -227,15 +227,15 @@ _pty_size(Termpty *ty)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_handle_read(Termpty *ty, Eina_Bool false_on_empty)
|
_handle_read(Termpty *ty, Eina_Bool false_on_empty)
|
||||||
{
|
{
|
||||||
char buf[4097];
|
int len, reads;
|
||||||
Eina_Unicode codepoint[4097];
|
|
||||||
int len, i, j, reads;
|
|
||||||
unsigned int k;
|
|
||||||
|
|
||||||
// read up to 64 * 4096 bytes
|
// read up to 64 * 4096 bytes
|
||||||
for (reads = 0; reads < 64; reads++)
|
for (reads = 0; reads < 64; reads++)
|
||||||
{
|
{
|
||||||
|
Eina_Unicode codepoint[4097];
|
||||||
|
char buf[4097];
|
||||||
char *rbuf = buf;
|
char *rbuf = buf;
|
||||||
|
int i, j;
|
||||||
len = sizeof(buf) - 1;
|
len = sizeof(buf) - 1;
|
||||||
|
|
||||||
for (i = 0; i < (int)sizeof(ty->oldbuf) && ty->oldbuf[i] & 0x80; i++)
|
for (i = 0; i < (int)sizeof(ty->oldbuf) && ty->oldbuf[i] & 0x80; i++)
|
||||||
|
@ -293,6 +293,8 @@ _handle_read(Termpty *ty, Eina_Bool false_on_empty)
|
||||||
if ((0xdc80 <= g) && (g <= 0xdcff) &&
|
if ((0xdc80 <= g) && (g <= 0xdcff) &&
|
||||||
(len - prev_i) <= (int)sizeof(ty->oldbuf))
|
(len - prev_i) <= (int)sizeof(ty->oldbuf))
|
||||||
{
|
{
|
||||||
|
unsigned int k;
|
||||||
|
|
||||||
for (k = 0;
|
for (k = 0;
|
||||||
(k < (unsigned int)sizeof(ty->oldbuf)) &&
|
(k < (unsigned int)sizeof(ty->oldbuf)) &&
|
||||||
(k < (unsigned int)(len - prev_i));
|
(k < (unsigned int)(len - prev_i));
|
||||||
|
@ -474,7 +476,7 @@ termpty_resize_tabs(Termpty *ty, int old_w, int new_w)
|
||||||
{
|
{
|
||||||
unsigned int *new_tabs;
|
unsigned int *new_tabs;
|
||||||
int i;
|
int i;
|
||||||
size_t nb_elems, n;
|
size_t nb_elems;
|
||||||
|
|
||||||
if ((new_w == old_w) && ty->tabs) return;
|
if ((new_w == old_w) && ty->tabs) return;
|
||||||
|
|
||||||
|
@ -484,7 +486,7 @@ termpty_resize_tabs(Termpty *ty, int old_w, int new_w)
|
||||||
|
|
||||||
if (ty->tabs)
|
if (ty->tabs)
|
||||||
{
|
{
|
||||||
n = old_w;
|
size_t n = old_w;
|
||||||
if (nb_elems < n) n = nb_elems;
|
if (nb_elems < n) n = nb_elems;
|
||||||
if (n > 0) memcpy(new_tabs, ty->tabs, n * sizeof(unsigned int));
|
if (n > 0) memcpy(new_tabs, ty->tabs, n * sizeof(unsigned int));
|
||||||
free(ty->tabs);
|
free(ty->tabs);
|
||||||
|
@ -707,12 +709,9 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||||
}
|
}
|
||||||
if (!ty->pid)
|
if (!ty->pid)
|
||||||
{
|
{
|
||||||
char buf[256];
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (cd)
|
if (cd)
|
||||||
{
|
{
|
||||||
ret = chdir(cd);
|
int ret = chdir(cd);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
ERR(_("Could not change current directory to '%s': %s"),
|
ERR(_("Could not change current directory to '%s': %s"),
|
||||||
|
@ -772,6 +771,8 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||||
putenv("XTERM_256_COLORS=1");
|
putenv("XTERM_256_COLORS=1");
|
||||||
if (window_id)
|
if (window_id)
|
||||||
{
|
{
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "WINDOWID=%lu", window_id);
|
snprintf(buf, sizeof(buf), "WINDOWID=%lu", window_id);
|
||||||
putenv(buf);
|
putenv(buf);
|
||||||
}
|
}
|
||||||
|
@ -931,7 +932,7 @@ _termpty_line_is_empty(const Termcell *cells, ssize_t nb_cells)
|
||||||
ssize_t
|
ssize_t
|
||||||
termpty_line_length(const Termcell *cells, ssize_t nb_cells)
|
termpty_line_length(const Termcell *cells, ssize_t nb_cells)
|
||||||
{
|
{
|
||||||
ssize_t len = nb_cells;
|
ssize_t len;
|
||||||
|
|
||||||
if (!cells)
|
if (!cells)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -38,8 +38,8 @@ termpty_cells_clear(Termpty *ty, Termcell *cells, int count)
|
||||||
void
|
void
|
||||||
termpty_text_scroll(Termpty *ty, Eina_Bool clear)
|
termpty_text_scroll(Termpty *ty, Eina_Bool clear)
|
||||||
{
|
{
|
||||||
Termcell *cells = NULL, *cells2;
|
Termcell *cells = NULL;
|
||||||
int y, start_y = 0, end_y = ty->h - 1;
|
int start_y = 0, end_y = ty->h - 1;
|
||||||
|
|
||||||
start_y = ty->termstate.top_margin;
|
start_y = ty->termstate.top_margin;
|
||||||
if (ty->termstate.bottom_margin != 0)
|
if (ty->termstate.bottom_margin != 0)
|
||||||
|
@ -69,6 +69,7 @@ termpty_text_scroll(Termpty *ty, Eina_Bool clear)
|
||||||
{
|
{
|
||||||
int x = ty->termstate.left_margin;
|
int x = ty->termstate.left_margin;
|
||||||
int w = ty->w - x;
|
int w = ty->w - x;
|
||||||
|
int y;
|
||||||
|
|
||||||
if (ty->termstate.right_margin)
|
if (ty->termstate.right_margin)
|
||||||
w = ty->termstate.right_margin - x;
|
w = ty->termstate.right_margin - x;
|
||||||
|
@ -76,6 +77,8 @@ termpty_text_scroll(Termpty *ty, Eina_Bool clear)
|
||||||
cells = &(TERMPTY_SCREEN(ty, x, end_y));
|
cells = &(TERMPTY_SCREEN(ty, x, end_y));
|
||||||
for (y = start_y; y < end_y; y++)
|
for (y = start_y; y < end_y; y++)
|
||||||
{
|
{
|
||||||
|
Termcell *cells2;
|
||||||
|
|
||||||
cells = &(TERMPTY_SCREEN(ty, x, (y + 1)));
|
cells = &(TERMPTY_SCREEN(ty, x, (y + 1)));
|
||||||
cells2 = &(TERMPTY_SCREEN(ty, x, y));
|
cells2 = &(TERMPTY_SCREEN(ty, x, y));
|
||||||
TERMPTY_CELL_COPY(ty, cells, cells2, w);
|
TERMPTY_CELL_COPY(ty, cells, cells2, w);
|
||||||
|
@ -88,8 +91,8 @@ termpty_text_scroll(Termpty *ty, Eina_Bool clear)
|
||||||
void
|
void
|
||||||
termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
|
termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
|
||||||
{
|
{
|
||||||
Termcell *cells, *cells2 = NULL;
|
Termcell *cells;
|
||||||
int y, start_y = 0, end_y = ty->h - 1;
|
int start_y = 0, end_y = ty->h - 1;
|
||||||
|
|
||||||
if (ty->termstate.bottom_margin != 0)
|
if (ty->termstate.bottom_margin != 0)
|
||||||
{
|
{
|
||||||
|
@ -116,6 +119,7 @@ termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
|
||||||
{
|
{
|
||||||
int x = ty->termstate.left_margin;
|
int x = ty->termstate.left_margin;
|
||||||
int w = ty->w - x;
|
int w = ty->w - x;
|
||||||
|
int y;
|
||||||
|
|
||||||
if (ty->termstate.right_margin)
|
if (ty->termstate.right_margin)
|
||||||
w = ty->termstate.right_margin - x;
|
w = ty->termstate.right_margin - x;
|
||||||
|
@ -123,6 +127,8 @@ termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
|
||||||
cells = &(TERMPTY_SCREEN(ty, x, end_y));
|
cells = &(TERMPTY_SCREEN(ty, x, end_y));
|
||||||
for (y = end_y; y > start_y; y--)
|
for (y = end_y; y > start_y; y--)
|
||||||
{
|
{
|
||||||
|
Termcell *cells2;
|
||||||
|
|
||||||
cells = &(TERMPTY_SCREEN(ty, x, (y - 1)));
|
cells = &(TERMPTY_SCREEN(ty, x, (y - 1)));
|
||||||
cells2 = &(TERMPTY_SCREEN(ty, x, y));
|
cells2 = &(TERMPTY_SCREEN(ty, x, y));
|
||||||
TERMPTY_CELL_COPY(ty, cells, cells2, w);
|
TERMPTY_CELL_COPY(ty, cells, cells2, w);
|
||||||
|
|
|
@ -69,12 +69,12 @@ scaleterm(int w, int h, int *iw, int *ih)
|
||||||
static const char *
|
static const char *
|
||||||
is_fmt(const char *f, const char **extn)
|
is_fmt(const char *f, const char **extn)
|
||||||
{
|
{
|
||||||
int i, len, l;
|
int i, len;
|
||||||
|
|
||||||
len = strlen(f);
|
len = strlen(f);
|
||||||
for (i = 0; extn[i]; i++)
|
for (i = 0; extn[i]; i++)
|
||||||
{
|
{
|
||||||
l = strlen(extn[i]);
|
int l = strlen(extn[i]);
|
||||||
if (len < l) continue;
|
if (len < l) continue;
|
||||||
if (!strcasecmp(extn[i], f + len - l)) return extn[i];
|
if (!strcasecmp(extn[i], f + len - l)) return extn[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,10 +287,6 @@ _termpty_init(Termpty *ty, Config *config)
|
||||||
int
|
int
|
||||||
main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
||||||
{
|
{
|
||||||
char buf[4097];
|
|
||||||
Eina_Unicode codepoint[4097];
|
|
||||||
int len, i, j, k;
|
|
||||||
|
|
||||||
eina_init();
|
eina_init();
|
||||||
|
|
||||||
#ifdef TYTEST
|
#ifdef TYTEST
|
||||||
|
@ -319,8 +315,11 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
char buf[4097];
|
||||||
|
Eina_Unicode codepoint[4097];
|
||||||
|
int i, j;
|
||||||
char *rbuf = buf;
|
char *rbuf = buf;
|
||||||
len = sizeof(buf) - 1;
|
int len = sizeof(buf) - 1;
|
||||||
|
|
||||||
for (i = 0; i < (int)sizeof(_ty.oldbuf) && _ty.oldbuf[i] & 0x80; i++)
|
for (i = 0; i < (int)sizeof(_ty.oldbuf) && _ty.oldbuf[i] & 0x80; i++)
|
||||||
{
|
{
|
||||||
|
@ -354,6 +353,7 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
||||||
if ((0xdc80 <= g) && (g <= 0xdcff) &&
|
if ((0xdc80 <= g) && (g <= 0xdcff) &&
|
||||||
(len - prev_i) <= (int)sizeof(_ty.oldbuf))
|
(len - prev_i) <= (int)sizeof(_ty.oldbuf))
|
||||||
{
|
{
|
||||||
|
int k;
|
||||||
for (k = 0;
|
for (k = 0;
|
||||||
(k < (int)sizeof(_ty.oldbuf)) &&
|
(k < (int)sizeof(_ty.oldbuf)) &&
|
||||||
(k < (len - prev_i));
|
(k < (len - prev_i));
|
||||||
|
|
|
@ -98,7 +98,7 @@ colorprint(int mode, int fgbg, int r, int g, int b)
|
||||||
else if (mode == CORE) // 8 bg and 8 fg colors
|
else if (mode == CORE) // 8 bg and 8 fg colors
|
||||||
{
|
{
|
||||||
int v = 0;
|
int v = 0;
|
||||||
|
|
||||||
if (r & BRIGHT) printf("%c[01m", 0x1b);
|
if (r & BRIGHT) printf("%c[01m", 0x1b);
|
||||||
else printf("%c[0m", 0x1b);
|
else printf("%c[0m", 0x1b);
|
||||||
if (fgbg == FG) v = 30 + (r & 0x7);
|
if (fgbg == FG) v = 30 + (r & 0x7);
|
||||||
|
@ -108,7 +108,7 @@ colorprint(int mode, int fgbg, int r, int g, int b)
|
||||||
else if (mode == CUBE) // 6x6x6 cube
|
else if (mode == CUBE) // 6x6x6 cube
|
||||||
{
|
{
|
||||||
int v = 0, c = 0;
|
int v = 0, c = 0;
|
||||||
|
|
||||||
if (fgbg == FG) v = 38;
|
if (fgbg == FG) v = 38;
|
||||||
else v = 48;
|
else v = 48;
|
||||||
c = 16 + ((r * 6 * 6) + (g * 6) + b);
|
c = 16 + ((r * 6 * 6) + (g * 6) + b);
|
||||||
|
@ -244,7 +244,7 @@ const Cmatch fmatch[] =
|
||||||
{ 5, 5, 5, 9, 9, 9, "*.SRF", NULL},
|
{ 5, 5, 5, 9, 9, 9, "*.SRF", NULL},
|
||||||
{ 5, 5, 5, 9, 9, 9, "*.x3f", NULL},
|
{ 5, 5, 5, 9, 9, 9, "*.x3f", NULL},
|
||||||
{ 5, 5, 5, 9, 9, 9, "*.X3F", NULL},
|
{ 5, 5, 5, 9, 9, 9, "*.X3F", NULL},
|
||||||
|
|
||||||
{ 5, 5, 2, 9, 9, 9, "*.pdf", NULL},
|
{ 5, 5, 2, 9, 9, 9, "*.pdf", NULL},
|
||||||
{ 5, 5, 2, 9, 9, 9, "*.PDF", NULL},
|
{ 5, 5, 2, 9, 9, 9, "*.PDF", NULL},
|
||||||
{ 5, 5, 2, 9, 9, 9, "*.pdf", NULL},
|
{ 5, 5, 2, 9, 9, 9, "*.pdf", NULL},
|
||||||
|
@ -302,7 +302,7 @@ const Cmatch fmatch[] =
|
||||||
{ 3, 4, 5, 9, 9, 9, "*.3p2", NULL},
|
{ 3, 4, 5, 9, 9, 9, "*.3p2", NULL},
|
||||||
{ 3, 4, 5, 9, 9, 9, "*.264", NULL},
|
{ 3, 4, 5, 9, 9, 9, "*.264", NULL},
|
||||||
{ 3, 4, 5, 9, 9, 9, "*.3gp", NULL},
|
{ 3, 4, 5, 9, 9, 9, "*.3gp", NULL},
|
||||||
|
|
||||||
{ 2, 3, 5, 9, 9, 9, "*.mp3", "audio-x-mpeg.svg"},
|
{ 2, 3, 5, 9, 9, 9, "*.mp3", "audio-x-mpeg.svg"},
|
||||||
{ 2, 3, 5, 9, 9, 9, "*.MP3", "audio-x-mpeg.svg"},
|
{ 2, 3, 5, 9, 9, 9, "*.MP3", "audio-x-mpeg.svg"},
|
||||||
{ 2, 3, 5, 9, 9, 9, "*.aac", "audio-x-generic.svg"},
|
{ 2, 3, 5, 9, 9, 9, "*.aac", "audio-x-generic.svg"},
|
||||||
|
@ -313,7 +313,7 @@ const Cmatch fmatch[] =
|
||||||
{ 2, 3, 5, 9, 9, 9, "*.WAV", "audio-x-wav.svg"},
|
{ 2, 3, 5, 9, 9, 9, "*.WAV", "audio-x-wav.svg"},
|
||||||
{ 2, 3, 5, 9, 9, 9, "*.m3u", "audio-x-mp3-playlist"},
|
{ 2, 3, 5, 9, 9, 9, "*.m3u", "audio-x-mp3-playlist"},
|
||||||
{ 2, 3, 5, 9, 9, 9, "*.M3U", "audio-x-mp3-playlist"},
|
{ 2, 3, 5, 9, 9, 9, "*.M3U", "audio-x-mp3-playlist"},
|
||||||
|
|
||||||
{ 3, 5, 2, 9, 9, 9, "*.patch", "text-x-generic"},
|
{ 3, 5, 2, 9, 9, 9, "*.patch", "text-x-generic"},
|
||||||
{ 3, 5, 2, 9, 9, 9, "*.PATCH", "text-x-generic"},
|
{ 3, 5, 2, 9, 9, 9, "*.PATCH", "text-x-generic"},
|
||||||
{ 3, 5, 2, 9, 9, 9, "*.diff", "text-x-generic"},
|
{ 3, 5, 2, 9, 9, 9, "*.diff", "text-x-generic"},
|
||||||
|
@ -347,7 +347,7 @@ const Cmatch fmatch[] =
|
||||||
{ 0, 5, 2, 9, 9, 9, "*.ISO", "application-x-cd-image"},
|
{ 0, 5, 2, 9, 9, 9, "*.ISO", "application-x-cd-image"},
|
||||||
{ 0, 5, 2, 9, 9, 9, "*.img", "text-x-generic"},
|
{ 0, 5, 2, 9, 9, 9, "*.img", "text-x-generic"},
|
||||||
{ 0, 5, 2, 9, 9, 9, "*.IMG", "text-x-generic"},
|
{ 0, 5, 2, 9, 9, 9, "*.IMG", "text-x-generic"},
|
||||||
|
|
||||||
{ 3, 5, 1, 9, 9, 9, "*.ttf", "font-x-generic"},
|
{ 3, 5, 1, 9, 9, 9, "*.ttf", "font-x-generic"},
|
||||||
{ 3, 5, 1, 9, 9, 9, "*.TTF", "font-x-generic"},
|
{ 3, 5, 1, 9, 9, 9, "*.TTF", "font-x-generic"},
|
||||||
{ 3, 5, 1, 9, 9, 9, "*.bdf", "font-x-generic"},
|
{ 3, 5, 1, 9, 9, 9, "*.bdf", "font-x-generic"},
|
||||||
|
@ -356,7 +356,7 @@ const Cmatch fmatch[] =
|
||||||
{ 3, 5, 1, 9, 9, 9, "*.PCF", "font-x-generic"},
|
{ 3, 5, 1, 9, 9, 9, "*.PCF", "font-x-generic"},
|
||||||
|
|
||||||
{ 1, 1, 1, 9, 9, 9, "*~", "text-x-generic"},
|
{ 1, 1, 1, 9, 9, 9, "*~", "text-x-generic"},
|
||||||
|
|
||||||
{ 1, 2, 2, 9, 9, 9, "stamp-h1", "text-x-generic"},
|
{ 1, 2, 2, 9, 9, 9, "stamp-h1", "text-x-generic"},
|
||||||
|
|
||||||
{ 5, 3, 1, 9, 9, 9, "Makefile", "text-x-generic"},
|
{ 5, 3, 1, 9, 9, 9, "Makefile", "text-x-generic"},
|
||||||
|
@ -364,9 +364,9 @@ const Cmatch fmatch[] =
|
||||||
{ 3, 1, 0, 9, 9, 9, "*.am", "text-x-generic"},
|
{ 3, 1, 0, 9, 9, 9, "*.am", "text-x-generic"},
|
||||||
|
|
||||||
{ 4, 2, 5, 9, 9, 9, "*.spec", "text-x-generic"},
|
{ 4, 2, 5, 9, 9, 9, "*.spec", "text-x-generic"},
|
||||||
|
|
||||||
{ 4, 1, 5, 9, 9, 9, "*.m4", "application-x-m4"},
|
{ 4, 1, 5, 9, 9, 9, "*.m4", "application-x-m4"},
|
||||||
|
|
||||||
{ 5, 2, 0, 9, 9, 9, "*.sh", "text-x-generic"},
|
{ 5, 2, 0, 9, 9, 9, "*.sh", "text-x-generic"},
|
||||||
{ 5, 2, 0, 9, 9, 9, "*.SH", "text-x-generic"},
|
{ 5, 2, 0, 9, 9, 9, "*.SH", "text-x-generic"},
|
||||||
{ 5, 2, 0, 9, 9, 9, "*.bin", "text-x-generic"},
|
{ 5, 2, 0, 9, 9, 9, "*.bin", "text-x-generic"},
|
||||||
|
@ -379,7 +379,7 @@ const Cmatch fmatch[] =
|
||||||
{ 5, 2, 0, 9, 9, 9, "configure.ac", "text-x-generic"},
|
{ 5, 2, 0, 9, 9, 9, "configure.ac", "text-x-generic"},
|
||||||
|
|
||||||
{ 2, 2, 3, 9, 9, 9, "*.in", "text-x-generic"},
|
{ 2, 2, 3, 9, 9, 9, "*.in", "text-x-generic"},
|
||||||
|
|
||||||
{ 0, 5, 5, 9, 9, 9, "*.c", "text-x-c"},
|
{ 0, 5, 5, 9, 9, 9, "*.c", "text-x-c"},
|
||||||
{ 0, 5, 5, 9, 9, 9, "*.C", "text-x-c"},
|
{ 0, 5, 5, 9, 9, 9, "*.C", "text-x-c"},
|
||||||
{ 1, 4, 5, 9, 9, 9, "*.x", "text-x-c"},
|
{ 1, 4, 5, 9, 9, 9, "*.x", "text-x-c"},
|
||||||
|
@ -392,7 +392,7 @@ const Cmatch fmatch[] =
|
||||||
|
|
||||||
{ 5, 3, 0, 9, 9, 9, "*.edj", "text-x-generic"},
|
{ 5, 3, 0, 9, 9, 9, "*.edj", "text-x-generic"},
|
||||||
{ 5, 3, 0, 9, 9, 9, "*.EDJ", "text-x-generic"},
|
{ 5, 3, 0, 9, 9, 9, "*.EDJ", "text-x-generic"},
|
||||||
|
|
||||||
{ 5, 0, 5, 9, 9, 9, "*.cc", "text-x-c++"},
|
{ 5, 0, 5, 9, 9, 9, "*.cc", "text-x-c++"},
|
||||||
{ 5, 0, 5, 9, 9, 9, "*.CC", "text-x-c++"},
|
{ 5, 0, 5, 9, 9, 9, "*.CC", "text-x-c++"},
|
||||||
{ 3, 1, 5, 9, 9, 9, "*.hh", "text-x-c++hdr"},
|
{ 3, 1, 5, 9, 9, 9, "*.hh", "text-x-c++hdr"},
|
||||||
|
@ -403,7 +403,7 @@ const Cmatch fmatch[] =
|
||||||
|
|
||||||
{ 2, 0, 5, 9, 9, 9, "*.desktop", "application-x-desktop"},
|
{ 2, 0, 5, 9, 9, 9, "*.desktop", "application-x-desktop"},
|
||||||
{ 2, 0, 5, 9, 9, 9, "*.directory", "application-x-desktop"},
|
{ 2, 0, 5, 9, 9, 9, "*.directory", "application-x-desktop"},
|
||||||
|
|
||||||
{ 0, 1, 3, 9, 9, 9, "*.o", "text-x-generic"},
|
{ 0, 1, 3, 9, 9, 9, "*.o", "text-x-generic"},
|
||||||
{ 0, 1, 3, 9, 9, 9, "*.O", "text-x-generic"},
|
{ 0, 1, 3, 9, 9, 9, "*.O", "text-x-generic"},
|
||||||
{ 0, 1, 3, 9, 9, 9, "*.lo", "text-x-generic"},
|
{ 0, 1, 3, 9, 9, 9, "*.lo", "text-x-generic"},
|
||||||
|
@ -435,7 +435,7 @@ const Cmatch fmatch[] =
|
||||||
{ 3, 1, 5, 9, 9, 9, "*.HTM", "text-x-html"},
|
{ 3, 1, 5, 9, 9, 9, "*.HTM", "text-x-html"},
|
||||||
{ 3, 1, 5, 9, 9, 9, "*.css", "text-x-css"},
|
{ 3, 1, 5, 9, 9, 9, "*.css", "text-x-css"},
|
||||||
{ 3, 1, 5, 9, 9, 9, "*.CSS", "text-x-css"},
|
{ 3, 1, 5, 9, 9, 9, "*.CSS", "text-x-css"},
|
||||||
|
|
||||||
{ 0, 0, 0, 0, 0, 0, NULL, NULL}
|
{ 0, 0, 0, 0, 0, 0, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ const Cmatch xmatch[] =
|
||||||
{ 4, 0, 4, 9, 9, 9, "*.EXE", "application-x-executable"},
|
{ 4, 0, 4, 9, 9, 9, "*.EXE", "application-x-executable"},
|
||||||
|
|
||||||
{ 5, 0, 5, 9, 9, 9, "*", "application-x-executable"},
|
{ 5, 0, 5, 9, 9, 9, "*", "application-x-executable"},
|
||||||
|
|
||||||
{ 0, 0, 0, 0, 0, 0, NULL, NULL}
|
{ 0, 0, 0, 0, 0, 0, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ static const char *
|
||||||
filematch(const char *name, const Cmatch *m)
|
filematch(const char *name, const Cmatch *m)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; m[i].match; i++)
|
for (i = 0; m[i].match; i++)
|
||||||
{
|
{
|
||||||
if (!fnmatch(m[i].match, name, 0))
|
if (!fnmatch(m[i].match, name, 0))
|
||||||
|
@ -483,7 +483,7 @@ fileicon(const char *path)
|
||||||
Eina_Bool isdir = EINA_FALSE;
|
Eina_Bool isdir = EINA_FALSE;
|
||||||
Eina_Bool isexec = EINA_FALSE;
|
Eina_Bool isexec = EINA_FALSE;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
name = ecore_file_file_get(path);
|
name = ecore_file_file_get(path);
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
|
@ -502,7 +502,7 @@ static Eina_Bool
|
||||||
printmatch(const char *name, const Cmatch *m)
|
printmatch(const char *name, const Cmatch *m)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; m[i].match; i++)
|
for (i = 0; m[i].match; i++)
|
||||||
{
|
{
|
||||||
if (!fnmatch(m[i].match, name, 0))
|
if (!fnmatch(m[i].match, name, 0))
|
||||||
|
@ -522,11 +522,11 @@ fileprint(char *path, char *name, Eina_Bool type)
|
||||||
Eina_Bool isdir = EINA_FALSE;
|
Eina_Bool isdir = EINA_FALSE;
|
||||||
Eina_Bool islink = EINA_FALSE;
|
Eina_Bool islink = EINA_FALSE;
|
||||||
Eina_Bool isexec = EINA_FALSE;
|
Eina_Bool isexec = EINA_FALSE;
|
||||||
|
|
||||||
if (name || type)
|
if (name || type)
|
||||||
{
|
{
|
||||||
char *ts;
|
char *ts;
|
||||||
|
|
||||||
if (ecore_file_is_dir(path)) isdir = EINA_TRUE;
|
if (ecore_file_is_dir(path)) isdir = EINA_TRUE;
|
||||||
ts = ecore_file_readlink(path);
|
ts = ecore_file_readlink(path);
|
||||||
if (ts)
|
if (ts)
|
||||||
|
@ -590,8 +590,8 @@ list_dir(const char *dir, Tyls_Options *options)
|
||||||
{
|
{
|
||||||
Eina_List *files, *l;
|
Eina_List *files, *l;
|
||||||
char *s, **names;
|
char *s, **names;
|
||||||
int maxlen = 0, cols, c, rows, i, j, num, cw, stuff;
|
int maxlen = 0, i, num, stuff;
|
||||||
|
|
||||||
files = ecore_file_ls(dir);
|
files = ecore_file_ls(dir);
|
||||||
if (!files) return;
|
if (!files) return;
|
||||||
names = calloc(eina_list_count(files) * 2, sizeof(char *));
|
names = calloc(eina_list_count(files) * 2, sizeof(char *));
|
||||||
|
@ -600,7 +600,7 @@ list_dir(const char *dir, Tyls_Options *options)
|
||||||
EINA_LIST_FOREACH(files, l, s)
|
EINA_LIST_FOREACH(files, l, s)
|
||||||
{
|
{
|
||||||
int len = eina_unicode_utf8_get_len(s);
|
int len = eina_unicode_utf8_get_len(s);
|
||||||
|
|
||||||
if (s[0] == '.' && options->hidden == EINA_FALSE) continue;
|
if (s[0] == '.' && options->hidden == EINA_FALSE) continue;
|
||||||
if (len > maxlen) maxlen = len;
|
if (len > maxlen) maxlen = len;
|
||||||
names[i] = s;
|
names[i] = s;
|
||||||
|
@ -618,7 +618,9 @@ list_dir(const char *dir, Tyls_Options *options)
|
||||||
maxlen += stuff;
|
maxlen += stuff;
|
||||||
if (maxlen > 0)
|
if (maxlen > 0)
|
||||||
{
|
{
|
||||||
cols = tw / maxlen;
|
int rows;
|
||||||
|
int cols = tw / maxlen;
|
||||||
|
|
||||||
if (cols < 1) cols = 1;
|
if (cols < 1) cols = 1;
|
||||||
if (cols == 1)
|
if (cols == 1)
|
||||||
{
|
{
|
||||||
|
@ -632,14 +634,15 @@ list_dir(const char *dir, Tyls_Options *options)
|
||||||
{
|
{
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
const char *icon;
|
const char *icon;
|
||||||
|
int c, j, cw;
|
||||||
|
|
||||||
if (options->mode == SMALL)
|
if (options->mode == SMALL)
|
||||||
{
|
{
|
||||||
for (c = 0; c < cols; c++)
|
for (c = 0; c < cols; c++)
|
||||||
{
|
{
|
||||||
char sz[6], szch = ' ';
|
char sz[6], szch = ' ';
|
||||||
long long size;
|
long long size;
|
||||||
|
|
||||||
s = names[(c * rows) + i];
|
s = names[(c * rows) + i];
|
||||||
if (!s) continue;
|
if (!s) continue;
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", dir, s);
|
snprintf(buf, sizeof(buf), "%s/%s", dir, s);
|
||||||
|
@ -694,7 +697,7 @@ list_dir(const char *dir, Tyls_Options *options)
|
||||||
char sz[6], szch = ' ';
|
char sz[6], szch = ' ';
|
||||||
long long size;
|
long long size;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
s = names[(c * rows) + i];
|
s = names[(c * rows) + i];
|
||||||
if (!s) continue;
|
if (!s) continue;
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", dir, s);
|
snprintf(buf, sizeof(buf), "%s/%s", dir, s);
|
||||||
|
@ -738,9 +741,6 @@ print_usage(const char *argv0)
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char buf[64];
|
|
||||||
char *path;
|
|
||||||
Eina_List *dirs = NULL;
|
|
||||||
Tyls_Options options = {SMALL, EINA_FALSE};
|
Tyls_Options options = {SMALL, EINA_FALSE};
|
||||||
|
|
||||||
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
||||||
|
@ -759,7 +759,9 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, cw, ch;
|
int i, cw, ch;
|
||||||
int len;
|
int len;
|
||||||
char *rp;
|
char buf[64];
|
||||||
|
char *path;
|
||||||
|
Eina_List *dirs = NULL;
|
||||||
|
|
||||||
evas = ecore_evas_get(ee);
|
evas = ecore_evas_get(ee);
|
||||||
echo_off();
|
echo_off();
|
||||||
|
@ -806,7 +808,9 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
EINA_LIST_FREE(dirs, path)
|
EINA_LIST_FREE(dirs, path)
|
||||||
{
|
{
|
||||||
if ((rp = ecore_file_realpath(path))
|
char *rp;
|
||||||
|
|
||||||
|
if ((rp = ecore_file_realpath(path))
|
||||||
&& ecore_file_is_dir(rp))
|
&& ecore_file_is_dir(rp))
|
||||||
{
|
{
|
||||||
list_dir(rp, &options);
|
list_dir(rp, &options);
|
||||||
|
@ -814,7 +818,6 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
// ecore_main_loop_begin();
|
|
||||||
ecore_evas_free(ee);
|
ecore_evas_free(ee);
|
||||||
}
|
}
|
||||||
emotion_shutdown();
|
emotion_shutdown();
|
||||||
|
|
Loading…
Reference in New Issue