summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: edd085a)
raw | patch | inline | side by side (parent: edd085a)
author | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 17 Apr 2008 12:11:59 +0000 (14:11 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 17 Apr 2008 12:11:59 +0000 (14:11 +0200) |
Rename the default tab size from TABSIZE to TAB_SIZE, since it shadows
the public ncurses TABSIZE variable which controls how the waddch-family
expands tabs when drawing. This makes it possible to finally handle
tabsizes different from 8 for UTF-8.
the public ncurses TABSIZE variable which controls how the waddch-family
expands tabs when drawing. This makes it possible to finally handle
tabsizes different from 8 for UTF-8.
tig.c | patch | blob | history |
index 88d5225dc62f638dfb7227d5171d5abd8f3007fd..42a2da5a18bcf01b56b51c46e1f420b781c95dab 100644 (file)
--- a/tig.c
+++ b/tig.c
/* The default interval between line numbers. */
#define NUMBER_INTERVAL 5
-#define TABSIZE 8
+#define TAB_SIZE 8
#define SCALE_SPLIT_VIEW(height) ((height) * 2 / 3)
static bool opt_rev_graph = FALSE;
static bool opt_show_refs = TRUE;
static int opt_num_interval = NUMBER_INTERVAL;
-static int opt_tab_size = TABSIZE;
+static int opt_tab_size = TAB_SIZE;
static enum request opt_request = REQ_VIEW_MAIN;
static char opt_cmd[SIZEOF_STR] = "";
static char opt_path[SIZEOF_STR] = "";
static bool
pager_draw(struct view *view, struct line *line, unsigned int lineno, bool selected)
{
- static char spaces[] = " ";
char *text = line->data;
int col = 0;
@@ -2796,34 +2795,7 @@ pager_draw(struct view *view, struct line *line, unsigned int lineno, bool selec
if (!selected)
wattrset(view->win, get_line_attr(line->type));
- if (opt_tab_size < TABSIZE) {
- int col_offset = col;
-
- col = 0;
- while (text && col_offset + col < view->width) {
- int cols_max = view->width - col_offset - col;
- char *pos = text;
- int cols;
-
- if (*text == '\t') {
- text++;
- assert(sizeof(spaces) > TABSIZE);
- pos = spaces;
- cols = opt_tab_size - (col % opt_tab_size);
-
- } else {
- text = strchr(text, '\t');
- cols = line ? text - pos : strlen(pos);
- }
-
- waddnstr(view->win, pos, MIN(cols, cols_max));
- col += cols;
- }
-
- } else {
- draw_text(view, text, view->width - col, TRUE, selected);
- }
-
+ draw_text(view, text, view->width - col, TRUE, selected);
return TRUE;
}
/* Enable keyboard mapping */
keypad(status_win, TRUE);
wbkgdset(status_win, get_line_attr(LINE_STATUS));
+
+ TABSIZE = opt_tab_size;
}
static char *