Move contents to the bottom of the screen
Maybe this should have a switch.
This commit is contained in:
parent
a55fc17f31
commit
c8498c9165
27
sdn.cpp
27
sdn.cpp
|
@ -135,27 +135,21 @@ static struct {
|
||||||
wstring editor_line;
|
wstring editor_line;
|
||||||
} g;
|
} g;
|
||||||
|
|
||||||
static inline int visible_lines () { return LINES - 2; }
|
static inline int visible_lines () { return max (0, LINES - 2); }
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update () {
|
update () {
|
||||||
erase ();
|
erase ();
|
||||||
|
|
||||||
attrset (A_BOLD);
|
int available = visible_lines ();
|
||||||
mvprintw (0, 0, "%s", g.cwd.c_str ());
|
int used = min (available, int (g.entries.size ()) - g.offset);
|
||||||
if (g.out_of_date)
|
for (int i = 0; i < used; i++) {
|
||||||
addstr (" [+]");
|
|
||||||
|
|
||||||
for (int i = 0; i < visible_lines (); i++) {
|
|
||||||
int index = g.offset + i;
|
|
||||||
if (index >= int (g.entries.size ()))
|
|
||||||
break;
|
|
||||||
|
|
||||||
attrset (0);
|
attrset (0);
|
||||||
|
int index = g.offset + i;
|
||||||
if (index == g.cursor)
|
if (index == g.cursor)
|
||||||
attron (A_REVERSE);
|
attron (A_REVERSE);
|
||||||
|
|
||||||
move (2 + i, 0);
|
move (available - used + i, 0);
|
||||||
auto &entry = g.entries[index];
|
auto &entry = g.entries[index];
|
||||||
|
|
||||||
// TODO display more information from "info"
|
// TODO display more information from "info"
|
||||||
|
@ -174,12 +168,17 @@ update () {
|
||||||
hline (' ', width - print (to_wide (entry.filename), width));
|
hline (' ', width - print (to_wide (entry.filename), width));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attrset (A_BOLD);
|
||||||
|
mvprintw (LINES - 2, 0, "%s", g.cwd.c_str ());
|
||||||
|
if (g.out_of_date)
|
||||||
|
addstr (" [+]");
|
||||||
|
|
||||||
attrset (0);
|
attrset (0);
|
||||||
if (g.editor) {
|
if (g.editor) {
|
||||||
move (1, 0);
|
move (LINES - 1, 0);
|
||||||
wchar_t prefix[] = { g.editor, L' ', L'\0' };
|
wchar_t prefix[] = { g.editor, L' ', L'\0' };
|
||||||
addwstr (prefix);
|
addwstr (prefix);
|
||||||
move (1, print (g.editor_line, COLS - 3) + 2);
|
move (LINES - 1, print (g.editor_line, COLS - 3) + 2);
|
||||||
curs_set (1);
|
curs_set (1);
|
||||||
} else
|
} else
|
||||||
curs_set (0);
|
curs_set (0);
|
||||||
|
|
Loading…
Reference in New Issue