* editdraw.c (edit_status): Fixed drawing bug with ncurses.
Этот коммит содержится в:
родитель
ff3ca5ecb2
Коммит
067e407cf7
@ -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>
|
2004-12-03 Roland Illig <roland.illig@gmx.de>
|
||||||
|
|
||||||
* edit.h: Renamed multiple inclusion guards that started with a
|
* 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);
|
byte_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the status line at the top of the widget. The status is displayed
|
/* Draw the status line at the top of the widget. The size of the filename
|
||||||
* right-aligned to be able to display long file names unshorteded. */
|
* field varies depending on the width of the screen and the length of
|
||||||
|
* the filename. */
|
||||||
void
|
void
|
||||||
edit_status (WEdit *edit)
|
edit_status (WEdit *edit)
|
||||||
{
|
{
|
||||||
@ -96,6 +97,8 @@ edit_status (WEdit *edit)
|
|||||||
const char *fname = "";
|
const char *fname = "";
|
||||||
size_t fname_len;
|
size_t fname_len;
|
||||||
const int gap = 3; /* between the filename and the status */
|
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_string (edit, status, status_size);
|
||||||
status_len = (int) strlen (status);
|
status_len = (int) strlen (status);
|
||||||
@ -103,22 +106,21 @@ edit_status (WEdit *edit)
|
|||||||
if (edit->filename)
|
if (edit->filename)
|
||||||
fname = edit->filename;
|
fname = edit->filename;
|
||||||
fname_len = strlen(fname);
|
fname_len = strlen(fname);
|
||||||
if (fname_len < 16)
|
if (fname_len < preferred_fname_len)
|
||||||
fname_len = 16;
|
fname_len = preferred_fname_len;
|
||||||
|
|
||||||
if (fname_len + gap + status_len + 2 >= w) {
|
if (fname_len + gap + status_len + right_gap >= w) {
|
||||||
if (16 + gap + status_len + 2 >= w)
|
if (preferred_fname_len + gap + status_len + right_gap >= w)
|
||||||
fname_len = 16;
|
fname_len = preferred_fname_len;
|
||||||
else
|
else
|
||||||
fname_len = w - (gap + status_len + 2);
|
fname_len = w - (gap + status_len + right_gap);
|
||||||
fname = name_trunc (fname, fname_len);
|
fname = name_trunc (fname, fname_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget_move (edit, 0, 0);
|
widget_move (edit, 0, 0);
|
||||||
attrset (SELECTED_COLOR);
|
attrset (SELECTED_COLOR);
|
||||||
printw ("%-*s", fname_len + gap, fname);
|
printwstr (fname, fname_len + gap);
|
||||||
if (fname_len + gap + 2 < w)
|
printwstr (status, w - (fname_len + gap));
|
||||||
printw ("%-*s ", w - (fname_len + gap + 2), status);
|
|
||||||
attrset (EDITOR_NORMAL_COLOR);
|
attrset (EDITOR_NORMAL_COLOR);
|
||||||
|
|
||||||
g_free (status);
|
g_free (status);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user