Add /help
Now with automatic search! Also had to fix the SIGCHLD handling...weechat-hashes
parent
f0e2c089c9
commit
5254e1035c
|
@ -179,6 +179,12 @@ or matching
|
||||||
Toggle logging in the
|
Toggle logging in the
|
||||||
.Sy <debug>
|
.Sy <debug>
|
||||||
window.
|
window.
|
||||||
|
.It Ic /help Op Ar search
|
||||||
|
View this manual.
|
||||||
|
Type
|
||||||
|
.Ic q
|
||||||
|
to return to
|
||||||
|
.Nm .
|
||||||
.It Ic /open Op Ar count
|
.It Ic /open Op Ar count
|
||||||
Open each of
|
Open each of
|
||||||
.Ar count
|
.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[SIGINT] || signals[SIGTERM]) break;
|
||||||
|
|
||||||
if (signals[SIGCHLD]) {
|
if (signals[SIGCHLD]) {
|
||||||
|
signals[SIGCHLD] = 0;
|
||||||
int status;
|
int status;
|
||||||
while (0 < waitpid(-1, &status, WNOHANG)) {
|
while (0 < waitpid(-1, &status, WNOHANG)) {
|
||||||
if (WIFEXITED(status) && WEXITSTATUS(status)) {
|
if (WIFEXITED(status) && WEXITSTATUS(status)) {
|
||||||
|
@ -206,6 +207,7 @@ int main(int argc, char *argv[]) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
uiShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (signals[SIGWINCH]) {
|
if (signals[SIGWINCH]) {
|
||||||
|
|
19
command.c
19
command.c
|
@ -18,6 +18,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "chat.h"
|
#include "chat.h"
|
||||||
|
|
||||||
|
@ -158,6 +159,23 @@ static void commandCopy(size_t id, char *params) {
|
||||||
urlCopyMatch(id, 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 {
|
static const struct Handler {
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
Command *fn;
|
Command *fn;
|
||||||
|
@ -165,6 +183,7 @@ static const struct Handler {
|
||||||
{ "/close", commandClose },
|
{ "/close", commandClose },
|
||||||
{ "/copy", commandCopy },
|
{ "/copy", commandCopy },
|
||||||
{ "/debug", commandDebug },
|
{ "/debug", commandDebug },
|
||||||
|
{ "/help", commandHelp },
|
||||||
{ "/join", commandJoin },
|
{ "/join", commandJoin },
|
||||||
{ "/me", commandMe },
|
{ "/me", commandMe },
|
||||||
{ "/names", commandNames },
|
{ "/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 *EnterPasteMode = "\33[?2004h";
|
||||||
static const char *ExitPasteMode = "\33[?2004l";
|
static const char *ExitPasteMode = "\33[?2004l";
|
||||||
|
|
||||||
|
static bool hidden;
|
||||||
|
|
||||||
void uiShow(void) {
|
void uiShow(void) {
|
||||||
putp(EnterFocusMode);
|
putp(EnterFocusMode);
|
||||||
putp(EnterPasteMode);
|
putp(EnterPasteMode);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
hidden = false;
|
||||||
|
uiDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiHide(void) {
|
void uiHide(void) {
|
||||||
|
hidden = true;
|
||||||
putp(ExitFocusMode);
|
putp(ExitFocusMode);
|
||||||
putp(ExitPasteMode);
|
putp(ExitPasteMode);
|
||||||
endwin();
|
endwin();
|
||||||
|
@ -250,6 +255,7 @@ void uiInit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiDraw(void) {
|
void uiDraw(void) {
|
||||||
|
if (hidden) return;
|
||||||
wnoutrefresh(status);
|
wnoutrefresh(status);
|
||||||
struct Window *window = windows.active;
|
struct Window *window = windows.active;
|
||||||
pnoutrefresh(
|
pnoutrefresh(
|
||||||
|
@ -755,6 +761,7 @@ static void keyStyle(wchar_t ch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiRead(void) {
|
void uiRead(void) {
|
||||||
|
if (hidden) return;
|
||||||
int ret;
|
int ret;
|
||||||
wint_t ch;
|
wint_t ch;
|
||||||
static bool style;
|
static bool style;
|
||||||
|
|
Loading…
Reference in New Issue