A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/b2cb05b53e61d162044f71227e0ffeacbf59a4bb below:

support SIGWINCH for Signal event #18029 · neovim/neovim@b2cb05b · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+30

-2

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+30

-2

lines changed Original file line number Diff line number Diff line change

@@ -870,7 +870,7 @@ ShellCmdPost After executing a shell command with |:!cmd|,

870 870

*Signal*

871 871

Signal After Nvim receives a signal. The pattern is

872 872

matched against the signal name. Only

873 -

"SIGUSR1" is supported. Example: >

873 +

"SIGUSR1" and "SIGWINCH" are supported. Example: >

874 874

autocmd Signal SIGUSR1 call some#func()

875 875

< *ShellFilterPost*

876 876

ShellFilterPost After executing a shell command with

Original file line number Diff line number Diff line change

@@ -21,7 +21,7 @@

21 21

#include "nvim/os/signal.h"

22 22

#include "nvim/vim.h"

23 23 24 -

static SignalWatcher spipe, shup, squit, sterm, susr1;

24 +

static SignalWatcher spipe, shup, squit, sterm, susr1, swinch;

25 25

#ifdef SIGPWR

26 26

static SignalWatcher spwr;

27 27

#endif

@@ -53,6 +53,9 @@ void signal_init(void)

53 53

#endif

54 54

#ifdef SIGUSR1

55 55

signal_watcher_init(&main_loop, &susr1, NULL);

56 +

#endif

57 +

#ifdef SIGWINCH

58 +

signal_watcher_init(&main_loop, &swinch, NULL);

56 59

#endif

57 60

signal_start();

58 61

}

@@ -70,6 +73,9 @@ void signal_teardown(void)

70 73

#ifdef SIGUSR1

71 74

signal_watcher_close(&susr1, NULL);

72 75

#endif

76 +

#ifdef SIGWINCH

77 +

signal_watcher_close(&swinch, NULL);

78 +

#endif

73 79

}

74 80 75 81

void signal_start(void)

@@ -88,6 +94,9 @@ void signal_start(void)

88 94

#ifdef SIGUSR1

89 95

signal_watcher_start(&susr1, on_signal, SIGUSR1);

90 96

#endif

97 +

#ifdef SIGWINCH

98 +

signal_watcher_start(&swinch, on_signal, SIGWINCH);

99 +

#endif

91 100

}

92 101 93 102

void signal_stop(void)

@@ -106,6 +115,9 @@ void signal_stop(void)

106 115

#ifdef SIGUSR1

107 116

signal_watcher_stop(&susr1);

108 117

#endif

118 +

#ifdef SIGWINCH

119 +

signal_watcher_stop(&swinch);

120 +

#endif

109 121

}

110 122 111 123

void signal_reject_deadly(void)

@@ -140,6 +152,10 @@ static char *signal_name(int signum)

140 152

#ifdef SIGUSR1

141 153

case SIGUSR1:

142 154

return "SIGUSR1";

155 +

#endif

156 +

#ifdef SIGWINCH

157 +

case SIGWINCH:

158 +

return "SIGWINCH";

143 159

#endif

144 160

default:

145 161

return "Unknown";

@@ -197,6 +213,12 @@ static void on_signal(SignalWatcher *handle, int signum, void *data)

197 213

apply_autocmds(EVENT_SIGNAL, (char_u *)"SIGUSR1", curbuf->b_fname, true,

198 214

curbuf);

199 215

break;

216 +

#endif

217 +

#ifdef SIGWINCH

218 +

case SIGWINCH:

219 +

apply_autocmds(EVENT_SIGNAL, (char_u *)"SIGWINCH", curbuf->b_fname, true,

220 +

curbuf);

221 +

break;

200 222

#endif

201 223

default:

202 224

ELOG("invalid signal: %d", signum);

Original file line number Diff line number Diff line change

@@ -30,6 +30,12 @@ describe('autocmd Signal', function()

30 30

eq({'notification', 'foo', {}}, next_msg())

31 31

end)

32 32 33 +

it('matches SIGWINCH', function()

34 +

command('autocmd Signal SIGWINCH call rpcnotify(1, "foo")')

35 +

posix_kill('WINCH', funcs.getpid())

36 +

eq({'notification', 'foo', {}}, next_msg())

37 +

end)

38 + 33 39

it('does not match unknown patterns', function()

34 40

command('autocmd Signal SIGUSR2 call rpcnotify(1, "foo")')

35 41

posix_kill('USR1', funcs.getpid())

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4