parent
4cda410b57
commit
adc6d3bdd2
|
@ -1,4 +1,4 @@
|
||||||
.Dd February 25, 2019
|
.Dd February 26, 2019
|
||||||
.Dt CATGIRL 1
|
.Dt CATGIRL 1
|
||||||
.Os
|
.Os
|
||||||
.
|
.
|
||||||
|
@ -304,6 +304,8 @@ Redraw the UI.
|
||||||
Switch to the next window.
|
Switch to the next window.
|
||||||
.It Ic C-p
|
.It Ic C-p
|
||||||
Switch to the previous window.
|
Switch to the previous window.
|
||||||
|
.It Ic M-/
|
||||||
|
Switch to the previously active window.
|
||||||
.It Ic M-a
|
.It Ic M-a
|
||||||
Switch to next hot or unread window.
|
Switch to next hot or unread window.
|
||||||
.It Ic M-l
|
.It Ic M-l
|
||||||
|
|
21
ui.c
21
ui.c
|
@ -61,6 +61,7 @@ struct Window {
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
struct Window *active;
|
struct Window *active;
|
||||||
|
struct Window *other;
|
||||||
struct Window *head;
|
struct Window *head;
|
||||||
struct Window *tail;
|
struct Window *tail;
|
||||||
struct Window *tag[TagsLen];
|
struct Window *tag[TagsLen];
|
||||||
|
@ -126,11 +127,13 @@ static void windowShow(struct Window *win) {
|
||||||
touchwin(win->log);
|
touchwin(win->log);
|
||||||
windowUnmark(win);
|
windowUnmark(win);
|
||||||
}
|
}
|
||||||
|
windows.other = windows.active;
|
||||||
windows.active = win;
|
windows.active = win;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowClose(struct Window *win) {
|
static void windowClose(struct Window *win) {
|
||||||
if (windows.active == win) windowShow(win->next ? win->next : win->prev);
|
if (windows.active == win) windowShow(win->next ? win->next : win->prev);
|
||||||
|
if (windows.other == win) windows.other = NULL;
|
||||||
windowRemove(win);
|
windowRemove(win);
|
||||||
delwin(win->log);
|
delwin(win->log);
|
||||||
free(win);
|
free(win);
|
||||||
|
@ -352,12 +355,16 @@ static void uiStatus(void) {
|
||||||
wclrtoeol(ui.status);
|
wclrtoeol(ui.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiShowTag(struct Tag tag) {
|
static void uiShowWindow(struct Window *win) {
|
||||||
windowShow(windowFor(tag));
|
windowShow(win);
|
||||||
uiStatus();
|
uiStatus();
|
||||||
uiPrompt(false);
|
uiPrompt(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiShowTag(struct Tag tag) {
|
||||||
|
uiShowWindow(windowFor(tag));
|
||||||
|
}
|
||||||
|
|
||||||
void uiShowNum(int num, bool relative) {
|
void uiShowNum(int num, bool relative) {
|
||||||
struct Window *win = (relative ? windows.active : windows.head);
|
struct Window *win = (relative ? windows.active : windows.head);
|
||||||
if (num < 0) {
|
if (num < 0) {
|
||||||
|
@ -365,10 +372,7 @@ void uiShowNum(int num, bool relative) {
|
||||||
} else {
|
} else {
|
||||||
for (; win; win = win->next) if (!num--) break;
|
for (; win; win = win->next) if (!num--) break;
|
||||||
}
|
}
|
||||||
if (!win) return;
|
if (win) uiShowWindow(win);
|
||||||
windowShow(win);
|
|
||||||
uiStatus();
|
|
||||||
uiPrompt(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void uiShowAuto(void) {
|
static void uiShowAuto(void) {
|
||||||
|
@ -379,9 +383,7 @@ static void uiShowAuto(void) {
|
||||||
if (!unread && hot->unread) unread = hot;
|
if (!unread && hot->unread) unread = hot;
|
||||||
}
|
}
|
||||||
if (!hot && !unread) return;
|
if (!hot && !unread) return;
|
||||||
windowShow(hot ? hot : unread);
|
uiShowWindow(hot ? hot : unread);
|
||||||
uiStatus();
|
|
||||||
uiPrompt(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiCloseTag(struct Tag tag) {
|
void uiCloseTag(struct Tag tag) {
|
||||||
|
@ -465,6 +467,7 @@ static void keyMeta(wchar_t ch) {
|
||||||
struct Window *win = windows.active;
|
struct Window *win = windows.active;
|
||||||
if (ch >= L'0' && ch <= L'9') uiShowNum(ch - L'0', false);
|
if (ch >= L'0' && ch <= L'9') uiShowNum(ch - L'0', false);
|
||||||
if (ch == L'a') uiShowAuto();
|
if (ch == L'a') uiShowAuto();
|
||||||
|
if (ch == L'/' && windows.other) uiShowWindow(windows.other);
|
||||||
if (!win) return;
|
if (!win) return;
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
break; case L'b': edit(win->tag, EditBackWord, 0);
|
break; case L'b': edit(win->tag, EditBackWord, 0);
|
||||||
|
|
Loading…
Reference in New Issue