Added symbol BAR_SEPARATOR
This commit is contained in:
parent
b8fa2e86fe
commit
b752d5c594
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
VERSION = git-20120214
|
VERSION = git-20120215
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -ansi -Wall -pedantic -O2
|
CFLAGS = -ansi -Wall -pedantic -O2
|
||||||
|
|
18
main.c
18
main.c
|
@ -231,8 +231,8 @@ void update_info(void) {
|
||||||
pw++;
|
pw++;
|
||||||
|
|
||||||
if (mode == MODE_THUMB) {
|
if (mode == MODE_THUMB) {
|
||||||
snprintf(win_bar_l, sizeof win_bar_l, "%0*d/%d %s",
|
snprintf(win_bar_l, sizeof win_bar_l, "%0*d/%d%s%s",
|
||||||
pw, tns.cnt > 0 ? tns.sel + 1 : 0, filecnt,
|
pw, tns.cnt > 0 ? tns.sel + 1 : 0, filecnt, BAR_SEPARATOR,
|
||||||
tns.cnt > 0 ? files[tns.sel].base : "");
|
tns.cnt > 0 ? files[tns.sel].base : "");
|
||||||
win_bar_r[0] = '\0';
|
win_bar_r[0] = '\0';
|
||||||
snprintf(win_title, sizeof win_title, "sxiv");
|
snprintf(win_title, sizeof win_title, "sxiv");
|
||||||
|
@ -242,16 +242,16 @@ void update_info(void) {
|
||||||
fw = 0;
|
fw = 0;
|
||||||
for (i = img.multi.cnt; i > 0; i /= 10)
|
for (i = img.multi.cnt; i > 0; i /= 10)
|
||||||
fw++;
|
fw++;
|
||||||
snprintf(frame_info, sizeof frame_info, " %0*d/%d",
|
snprintf(frame_info, sizeof frame_info, "%s%0*d/%d",
|
||||||
fw, img.multi.sel + 1, img.multi.cnt);
|
BAR_SEPARATOR, fw, img.multi.sel + 1, img.multi.cnt);
|
||||||
} else {
|
} else {
|
||||||
frame_info[0] = '\0';
|
frame_info[0] = '\0';
|
||||||
}
|
}
|
||||||
snprintf(win_bar_l, sizeof win_bar_l, "%0*d/%d %s",
|
snprintf(win_bar_l, sizeof win_bar_l, "%0*d/%d%s%s",
|
||||||
pw, fileidx + 1, filecnt, files[fileidx].base);
|
pw, fileidx + 1, filecnt, BAR_SEPARATOR, files[fileidx].base);
|
||||||
snprintf(win_bar_r, sizeof win_bar_r, "%.2f%s %dx%d %3d%%%s",
|
snprintf(win_bar_r, sizeof win_bar_r, "%.2f%s%s%dx%d%s%3d%%%s",
|
||||||
size, size_unit, img.w, img.h, (int) (img.zoom * 100.0),
|
size, size_unit, BAR_SEPARATOR, img.w, img.h, BAR_SEPARATOR,
|
||||||
frame_info);
|
(int) (img.zoom * 100.0), frame_info);
|
||||||
snprintf(win_title, sizeof win_title, "sxiv - %s",
|
snprintf(win_title, sizeof win_title, "sxiv - %s",
|
||||||
files[fileidx].name);
|
files[fileidx].name);
|
||||||
}
|
}
|
||||||
|
|
7
window.c
7
window.c
|
@ -334,7 +334,7 @@ int win_textwidth(const char *text, unsigned int len) {
|
||||||
}
|
}
|
||||||
void win_draw_bar(win_t *win) {
|
void win_draw_bar(win_t *win) {
|
||||||
win_env_t *e;
|
win_env_t *e;
|
||||||
int len, x, y, w, tw = 0;
|
int len, x, y, w, tw = 0, seplen;
|
||||||
const char *rt;
|
const char *rt;
|
||||||
|
|
||||||
if (win == NULL || win->xwin == None)
|
if (win == NULL || win->xwin == None)
|
||||||
|
@ -363,11 +363,12 @@ void win_draw_bar(win_t *win) {
|
||||||
}
|
}
|
||||||
if (win->rbar != NULL) {
|
if (win->rbar != NULL) {
|
||||||
len = strlen(win->rbar);
|
len = strlen(win->rbar);
|
||||||
|
seplen = strlen(BAR_SEPARATOR);
|
||||||
rt = win->rbar;
|
rt = win->rbar;
|
||||||
while (len > 0 && (tw = win_textwidth(rt, len)) > w) {
|
while (len > 0 && (tw = win_textwidth(rt, len)) > w) {
|
||||||
rt = strstr(rt, " ");
|
rt = strstr(rt, BAR_SEPARATOR);
|
||||||
if (rt != NULL) {
|
if (rt != NULL) {
|
||||||
rt += 2;
|
rt += seplen;
|
||||||
len = strlen(rt);
|
len = strlen(rt);
|
||||||
} else {
|
} else {
|
||||||
len = 0;
|
len = 0;
|
||||||
|
|
Loading…
Reference in a new issue