Skip to content

Commit

Permalink
new user-definable function intr (~mintty#1245)
Browse files Browse the repository at this point in the history
  • Loading branch information
mintty committed Dec 16, 2023
1 parent f1f764a commit 68de1e3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/mintty.1
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,10 @@ Tips wiki page \fIhttps://github.com/mintty/mintty/wiki/Tips#terminating-the-for
Note that Ctrl+C is often configured to raise a SIGINT signal. However,
this is not a terminal feature and can also be reconfigured (stty), so
in fact BRK and Ctrl+C are inherently different functions.
The user-definable function intr can be used to send the character that
is currently assigned to the SIGINT signal via stty settings; note however,
this does not work e.g. through ssh if the pty setting is changed, as the
remote side does not change the client side towards mintty.

.SS Mouse tracking

Expand Down Expand Up @@ -3128,6 +3132,8 @@ Supported actions are described as follows:
.br
\(en \fBbreak\fP: sends a break condition to the application
.br
\(en \fBintr\fP: sends the character mapped to SIGINT via stty settings
.br
\(en \fBflipscreen\fP: switches the alternate screen
.br
\(en \fBno-scroll\fP: locks output until input key is pressed
Expand Down
10 changes: 10 additions & 0 deletions src/child.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,16 @@ child_break()
}
}

/*
Send an INTR char.
*/
void
child_intr()
{
char * c_cc = (char *)child_termios_chars();
child_write(&c_cc[VINTR], 1);
}

void
child_printf(const char *fmt, ...)
{
Expand Down
1 change: 1 addition & 0 deletions src/child.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extern void child_proc(void);
extern void child_kill(bool point_blank);
extern void child_write(const char *, uint len);
extern void child_break(void);
extern void child_intr(void);
extern void child_printf(const char * fmt, ...) __attribute__((format(printf, 1, 2)));
extern void child_send(const char *, uint len);
extern void child_sendw(const wchar *, uint len);
Expand Down
1 change: 1 addition & 0 deletions src/wininput.c
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,7 @@ static struct function_def cmd_defs[] = {
{"tek-copy", {IDM_TEKCOPY}, mflags_tek_mode},
{"save-image", {IDM_SAVEIMG}, 0},
{"break", {IDM_BREAK}, 0},
{"intr", {.fct = child_intr}, 0},
{"flipscreen", {IDM_FLIPSCREEN}, mflags_flipscreen},
{"open", {IDM_OPEN}, mflags_open},
{"toggle-logging", {IDM_TOGLOG}, mflags_logging},
Expand Down
1 change: 1 addition & 0 deletions wiki/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Misc

Configuration
* New user-definable key Alt for option KeyFunctions (#1245).
* New user-definable function intr (~#1245).

### 3.7.0 (14 November 2023) ###

Expand Down

0 comments on commit 68de1e3

Please sign in to comment.