chiark
/
gitweb
/
~mdw
/
tig
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4887d44
)
update_view_title: use string_format_from instead of wprintw
author
Jonas Fonseca
<fonseca@diku.dk>
Sat, 16 Sep 2006 00:12:24 +0000
(
02:12
+0200)
committer
Jonas Fonseca
<fonseca@antimatter.localdomain>
Sat, 16 Sep 2006 00:12:24 +0000
(
02:12
+0200)
tig.c
patch
|
blob
|
blame
|
history
diff --git
a/tig.c
b/tig.c
index b0ce18ff29f103cc89d157630ae8026309de88c6..ef3fe0daba90278343cf406c9b3a0ca5cd6f804b 100644
(file)
--- a/
tig.c
+++ b/
tig.c
@@
-1315,20
+1315,14
@@
redraw_view(struct view *view)
static void
update_view_title(struct view *view)
{
static void
update_view_title(struct view *view)
{
- assert(view_is_displayed(view));
-
- if (view == display[current_view])
- wbkgdset(view->title, get_line_attr(LINE_TITLE_FOCUS));
- else
- wbkgdset(view->title, get_line_attr(LINE_TITLE_BLUR));
+ char buf[SIZEOF_STR];
+ size_t bufpos = 0;
- werase(view->title);
- wmove(view->title, 0, 0);
+ assert(view_is_displayed(view));
+ string_format_from(buf, &bufpos, "[%s]", view->name);
if (*view->ref)
if (*view->ref)
- wprintw(view->title, "[%s] %s", view->name, view->ref);
- else
- wprintw(view->title, "[%s]", view->name);
+ string_format_from(buf, &bufpos, " %s", view->ref);
if (view->lines || view->pipe) {
unsigned int view_lines = view->offset + view->height;
if (view->lines || view->pipe) {
unsigned int view_lines = view->offset + view->height;
@@
-1336,11
+1330,11
@@
update_view_title(struct view *view)
? MIN(view_lines, view->lines) * 100 / view->lines
: 0;
? MIN(view_lines, view->lines) * 100 / view->lines
: 0;
-
wprintw(view->title
, " - %s %d of %d (%d%%)",
- view->ops->type,
- view->lineno + 1,
- view->lines,
- lines);
+
string_format_from(buf, &bufpos
, " - %s %d of %d (%d%%)",
+
view->ops->type,
+
view->lineno + 1,
+
view->lines,
+
lines);
}
if (view->pipe) {
}
if (view->pipe) {
@@
-1348,9
+1342,16
@@
update_view_title(struct view *view)
/* Three git seconds are a long time ... */
if (secs > 2)
/* Three git seconds are a long time ... */
if (secs > 2)
-
wprintw(view->title
, " %lds", secs);
+
string_format_from(buf, &bufpos
, " %lds", secs);
}
}
+ if (view == display[current_view])
+ wbkgdset(view->title, get_line_attr(LINE_TITLE_FOCUS));
+ else
+ wbkgdset(view->title, get_line_attr(LINE_TITLE_BLUR));
+
+ werase(view->title);
+ mvwaddnstr(view->title, 0, 0, buf, bufpos);
wmove(view->title, 0, view->width - 1);
wrefresh(view->title);
}
wmove(view->title, 0, view->width - 1);
wrefresh(view->title);
}