summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7102999)
raw | patch | inline | side by side (parent: 7102999)
author | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 20 Mar 2008 00:54:26 +0000 (01:54 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 20 Mar 2008 11:38:51 +0000 (12:38 +0100) |
tig.c | patch | blob | history |
index 756ce47429abe83f70ed5ea21d1fd1f0f5721a38..1ae0a1e19c7f3226938d57b287fa327be37fa687 100644 (file)
--- a/tig.c
+++ b/tig.c
bool use_tilde, int tilde_attr)
{
int len = 0;
+ int trimmed = FALSE;
- if (max_len > 0) {
- int trimmed = FALSE;
+ if (max_len <= 0)
+ return 0;
- if (opt_utf8) {
- len = utf8_length(string, max_len, &trimmed, use_tilde);
- } else {
- len = strlen(string);
- if (len > max_len) {
- if (use_tilde) {
- max_len -= 1;
- }
- len = max_len;
- trimmed = TRUE;
+ if (opt_utf8) {
+ len = utf8_length(string, max_len, &trimmed, use_tilde);
+ } else {
+ len = strlen(string);
+ if (len > max_len) {
+ if (use_tilde) {
+ max_len -= 1;
}
+ len = max_len;
+ trimmed = TRUE;
}
- waddnstr(view->win, string, len);
- if (trimmed && use_tilde) {
- if (tilde_attr != -1)
- wattrset(view->win, tilde_attr);
- waddch(view->win, '~');
- len++;
- }
+ }
+
+ waddnstr(view->win, string, len);
+ if (trimmed && use_tilde) {
+ if (tilde_attr != -1)
+ wattrset(view->win, tilde_attr);
+ waddch(view->win, '~');
+ len++;
}
return len;