parent
f0e2c089c9
commit
5254e1035c
|
@ -179,6 +179,12 @@ or matching
|
|||
Toggle logging in the
|
||||
.Sy <debug>
|
||||
window.
|
||||
.It Ic /help Op Ar search
|
||||
View this manual.
|
||||
Type
|
||||
.Ic q
|
||||
to return to
|
||||
.Nm .
|
||||
.It Ic /open Op Ar count
|
||||
Open each of
|
||||
.Ar count
|
||||
|
|
2
chat.c
2
chat.c
|
@ -191,6 +191,7 @@ int main(int argc, char *argv[]) {
|
|||
if (signals[SIGINT] || signals[SIGTERM]) break;
|
||||
|
||||
if (signals[SIGCHLD]) {
|
||||
signals[SIGCHLD] = 0;
|
||||
int status;
|
||||
while (0 < waitpid(-1, &status, WNOHANG)) {
|
||||
if (WIFEXITED(status) && WEXITSTATUS(status)) {
|
||||
|
@ -206,6 +207,7 @@ int main(int argc, char *argv[]) {
|
|||
);
|
||||
}
|
||||
}
|
||||
uiShow();
|
||||
}
|
||||
|
||||
if (signals[SIGWINCH]) {
|
||||
|
|
19
command.c
19
command.c
|
@ -18,6 +18,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "chat.h"
|
||||
|
||||
|
@ -158,6 +159,23 @@ static void commandCopy(size_t id, char *params) {
|
|||
urlCopyMatch(id, params);
|
||||
}
|
||||
|
||||
static void commandHelp(size_t id, char *params) {
|
||||
(void)id;
|
||||
uiHide();
|
||||
|
||||
pid_t pid = fork();
|
||||
if (pid < 0) err(EX_OSERR, "fork");
|
||||
if (pid) return;
|
||||
|
||||
char buf[256];
|
||||
snprintf(buf, sizeof(buf), "ip%s$", (params ? params : "COMMANDS"));
|
||||
setenv("LESS", buf, 1);
|
||||
execlp("man", "man", "1", "catgirl", NULL);
|
||||
dup2(procPipe[1], STDERR_FILENO);
|
||||
warn("man");
|
||||
_exit(EX_UNAVAILABLE);
|
||||
}
|
||||
|
||||
static const struct Handler {
|
||||
const char *cmd;
|
||||
Command *fn;
|
||||
|
@ -165,6 +183,7 @@ static const struct Handler {
|
|||
{ "/close", commandClose },
|
||||
{ "/copy", commandCopy },
|
||||
{ "/debug", commandDebug },
|
||||
{ "/help", commandHelp },
|
||||
{ "/join", commandJoin },
|
||||
{ "/me", commandMe },
|
||||
{ "/names", commandNames },
|
||||
|
|
7
ui.c
7
ui.c
|
@ -156,13 +156,18 @@ static const char *ExitFocusMode = "\33[?1004l";
|
|||
static const char *EnterPasteMode = "\33[?2004h";
|
||||
static const char *ExitPasteMode = "\33[?2004l";
|
||||
|
||||
static bool hidden;
|
||||
|
||||
void uiShow(void) {
|
||||
putp(EnterFocusMode);
|
||||
putp(EnterPasteMode);
|
||||
fflush(stdout);
|
||||
hidden = false;
|
||||
uiDraw();
|
||||
}
|
||||
|
||||
void uiHide(void) {
|
||||
hidden = true;
|
||||
putp(ExitFocusMode);
|
||||
putp(ExitPasteMode);
|
||||
endwin();
|
||||
|
@ -250,6 +255,7 @@ void uiInit(void) {
|
|||
}
|
||||
|
||||
void uiDraw(void) {
|
||||
if (hidden) return;
|
||||
wnoutrefresh(status);
|
||||
struct Window *window = windows.active;
|
||||
pnoutrefresh(
|
||||
|
@ -755,6 +761,7 @@ static void keyStyle(wchar_t ch) {
|
|||
}
|
||||
|
||||
void uiRead(void) {
|
||||
if (hidden) return;
|
||||
int ret;
|
||||
wint_t ch;
|
||||
static bool style;
|
||||
|
|
Loading…
Reference in New Issue