1
1

* editdraw.c (edit_status): Fixed drawing bug with ncurses.

Этот коммит содержится в:
Roland Illig 2005-01-27 22:14:58 +00:00
родитель ff3ca5ecb2
Коммит 067e407cf7
2 изменённых файлов: 17 добавлений и 11 удалений

Просмотреть файл

@ -1,3 +1,7 @@
2005-01-26 Roland Illig <roland.illig@gmx.de>
* editdraw.c (edit_status): Fixed drawing bug with ncurses.
2004-12-03 Roland Illig <roland.illig@gmx.de>
* edit.h: Renamed multiple inclusion guards that started with a

Просмотреть файл

@ -84,8 +84,9 @@ static void status_string (WEdit * edit, char *s, int w)
byte_str);
}
/* Draw the status line at the top of the widget. The status is displayed
* right-aligned to be able to display long file names unshorteded. */
/* Draw the status line at the top of the widget. The size of the filename
* field varies depending on the width of the screen and the length of
* the filename. */
void
edit_status (WEdit *edit)
{
@ -96,6 +97,8 @@ edit_status (WEdit *edit)
const char *fname = "";
size_t fname_len;
const int gap = 3; /* between the filename and the status */
const int right_gap = 2; /* at the right end of the screen */
const int preferred_fname_len = 16;
status_string (edit, status, status_size);
status_len = (int) strlen (status);
@ -103,22 +106,21 @@ edit_status (WEdit *edit)
if (edit->filename)
fname = edit->filename;
fname_len = strlen(fname);
if (fname_len < 16)
fname_len = 16;
if (fname_len < preferred_fname_len)
fname_len = preferred_fname_len;
if (fname_len + gap + status_len + 2 >= w) {
if (16 + gap + status_len + 2 >= w)
fname_len = 16;
if (fname_len + gap + status_len + right_gap >= w) {
if (preferred_fname_len + gap + status_len + right_gap >= w)
fname_len = preferred_fname_len;
else
fname_len = w - (gap + status_len + 2);
fname_len = w - (gap + status_len + right_gap);
fname = name_trunc (fname, fname_len);
}
widget_move (edit, 0, 0);
attrset (SELECTED_COLOR);
printw ("%-*s", fname_len + gap, fname);
if (fname_len + gap + 2 < w)
printw ("%-*s ", w - (fname_len + gap + 2), status);
printwstr (fname, fname_len + gap);
printwstr (status, w - (fname_len + gap));
attrset (EDITOR_NORMAL_COLOR);
g_free (status);