Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Vim going background after running Tig #837

Merged
merged 1 commit into from
Jun 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ struct display_tty {
FILE *file;
int fd;
struct termios *attr;
pid_t opgrp;
};
static struct display_tty opt_tty = { NULL, -1, NULL };
static struct display_tty opt_tty = { NULL, -1, NULL, -1 };

static struct io script_io = { -1 };

Expand Down Expand Up @@ -572,6 +573,9 @@ done_display(void)
free(opt_tty.attr);
opt_tty.attr = NULL;
}
signal(SIGTTOU, SIG_IGN);
tcsetpgrp(opt_tty.fd, opt_tty.opgrp);
signal(SIGTTOU, SIG_DFL);
}

static void
Expand Down Expand Up @@ -602,6 +606,7 @@ init_tty(void)
/* process-group leader */
signal(SIGTTOU, SIG_IGN);
setpgid(getpid(), getpid());
opt_tty.opgrp = tcgetpgrp(opt_tty.fd);
tcsetpgrp(opt_tty.fd, getpid());
signal(SIGTTOU, SIG_DFL);
}
Expand Down