summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 47f8cdf)
raw | patch | inline | side by side (parent: 47f8cdf)
author | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 10 Jun 2010 23:43:48 +0000 (19:43 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 10 Jun 2010 23:43:48 +0000 (19:43 -0400) |
... fixes bug which truncated long lines to a fixed number of chars.
NEWS | patch | blob | history | |
tig.c | patch | blob | history |
index 86bad0c251fa751ed02fcdd3156e9aa38d8417ac..9f44a9f5f3a3b66c2c3d9bc71265da84c9dcdfeb 100644 (file)
--- a/NEWS
+++ b/NEWS
- Status view: fix usage from sub directories, which was broken by the
changes made to support blame view from sub directories.
+ - Fix text expansion to not truncate long lines
- Fix parsing of boolean show-date values.
- Fix relative date.
- Fix unbind to behave as if the keybinding was never defined.
index dd155e35e23a6b11fd3aedc9e5883085372ebdb7..e5612c197c7320b51ea0303284ab52718ca6d9eb 100644 (file)
--- a/tig.c
+++ b/tig.c
#define string_add(dst, from, src) \
string_ncopy_do(dst + (from), sizeof(dst) - (from), src, sizeof(src))
-static void
+static size_t
string_expand(char *dst, size_t dstlen, const char *src, int tabsize)
{
size_t size, pos;
}
dst[size] = 0;
+ return pos;
}
static char *
static bool
draw_text(struct view *view, enum line_type type, const char *string, bool trim)
{
- view->col += draw_chars(view, type, string, view->width + view->yoffset - view->col, trim);
+ char text[SIZEOF_STR];
+
+ do {
+ size_t pos = string_expand(text, sizeof(text), string, opt_tab_size);
+
+ view->col += draw_chars(view, type, text, view->width + view->yoffset - view->col, trim);
+ string += pos;
+ } while (*string && view->width + view->yoffset > view->col);
+
return view->width + view->yoffset <= view->col;
}
static bool
pager_draw(struct view *view, struct line *line, unsigned int lineno)
{
- char text[SIZEOF_STR];
-
if (opt_line_number && draw_lineno(view, lineno))
return TRUE;
- string_expand(text, sizeof(text), line->data, opt_tab_size);
- draw_text(view, line->type, text, TRUE);
+ draw_text(view, line->type, line->data, TRUE);
return TRUE;
}
struct blame *blame = line->data;
struct time *time = NULL;
const char *id = NULL, *author = NULL;
- char text[SIZEOF_STR];
if (blame->commit && *blame->commit->filename) {
id = blame->commit->id;
if (draw_lineno(view, lineno))
return TRUE;
- string_expand(text, sizeof(text), blame->text, opt_tab_size);
- draw_text(view, LINE_DEFAULT, text, TRUE);
+ draw_text(view, LINE_DEFAULT, blame->text, TRUE);
return TRUE;
}