Krolyxon
Commit b752d5c

Branches

Refs →

nsxivb752d5c

Added symbol BAR_SEPARATOR

Author
Bert Münnich
Date
2012-02-15 18:25 +0100
Parent
b8fa2e8
Commit
b752d5c594d5aac083cc563e8c7e575baf7b8edc

+16 −13

4 files changed

  1. M Makefile +1 −1
  2. M main.c +9 −9
  3. M window.c +4 −3
  4. M window.h +2 −0
M Makefile View
@@ -1,4 +1,4 @@
1−VERSION = git-20120214
1+VERSION = git-20120215
22
33 CC = gcc
44 CFLAGS = -ansi -Wall -pedantic -O2
M main.c View
@@ -231,8 +231,8 @@ void update_info(void) {
231231 pw++;
232232
233233 if (mode == MODE_THUMB) {
234− snprintf(win_bar_l, sizeof win_bar_l, "%0*d/%d %s",
235− pw, tns.cnt > 0 ? tns.sel + 1 : 0, filecnt,
234+ snprintf(win_bar_l, sizeof win_bar_l, "%0*d/%d%s%s",
235+ pw, tns.cnt > 0 ? tns.sel + 1 : 0, filecnt, BAR_SEPARATOR,
236236 tns.cnt > 0 ? files[tns.sel].base : "");
237237 win_bar_r[0] = '\0';
238238 snprintf(win_title, sizeof win_title, "sxiv");
@@ -242,16 +242,16 @@ void update_info(void) {
242242 fw = 0;
243243 for (i = img.multi.cnt; i > 0; i /= 10)
244244 fw++;
245− snprintf(frame_info, sizeof frame_info, " %0*d/%d",
246− fw, img.multi.sel + 1, img.multi.cnt);
245+ snprintf(frame_info, sizeof frame_info, "%s%0*d/%d",
246+ BAR_SEPARATOR, fw, img.multi.sel + 1, img.multi.cnt);
247247 } else {
248248 frame_info[0] = '\0';
249249 }
250− snprintf(win_bar_l, sizeof win_bar_l, "%0*d/%d %s",
251− pw, fileidx + 1, filecnt, files[fileidx].base);
252− snprintf(win_bar_r, sizeof win_bar_r, "%.2f%s %dx%d %3d%%%s",
253− size, size_unit, img.w, img.h, (int) (img.zoom * 100.0),
254− frame_info);
250+ snprintf(win_bar_l, sizeof win_bar_l, "%0*d/%d%s%s",
251+ pw, fileidx + 1, filecnt, BAR_SEPARATOR, files[fileidx].base);
252+ snprintf(win_bar_r, sizeof win_bar_r, "%.2f%s%s%dx%d%s%3d%%%s",
253+ size, size_unit, BAR_SEPARATOR, img.w, img.h, BAR_SEPARATOR,
254+ (int) (img.zoom * 100.0), frame_info);
255255 snprintf(win_title, sizeof win_title, "sxiv - %s",
256256 files[fileidx].name);
257257 }
M window.c View
@@ -334,7 +334,7 @@ int win_textwidth(const char *text, unsigned int len) {
334334 }
335335 void win_draw_bar(win_t *win) {
336336 win_env_t *e;
337− int len, x, y, w, tw = 0;
337+ int len, x, y, w, tw = 0, seplen;
338338 const char *rt;
339339
340340 if (win == NULL || win->xwin == None)
@@ -363,11 +363,12 @@ void win_draw_bar(win_t *win) {
363363 }
364364 if (win->rbar != NULL) {
365365 len = strlen(win->rbar);
366+ seplen = strlen(BAR_SEPARATOR);
366367 rt = win->rbar;
367368 while (len > 0 && (tw = win_textwidth(rt, len)) > w) {
368− rt = strstr(rt, " ");
369+ rt = strstr(rt, BAR_SEPARATOR);
369370 if (rt != NULL) {
370− rt += 2;
371+ rt += seplen;
371372 len = strlen(rt);
372373 } else {
373374 len = 0;
M window.h View
@@ -23,6 +23,8 @@
2323
2424 #include "types.h"
2525
26+#define BAR_SEPARATOR " | "
27+
2628 typedef struct {
2729 Display *dpy;
2830 int scr;