Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/profanity.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ prof_run(gchar* log_level, gchar* account_name, gchar* config_file, gchar* log_f
session_process_events();
iq_autoping_check();
ui_update();
while (g_main_context_iteration(NULL, FALSE))
;
#ifdef HAVE_GTK
tray_update();
#endif
Expand Down
7 changes: 7 additions & 0 deletions src/tools/editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <errno.h>
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>

#include "config/files.h"
#include "config/preferences.h"
Expand Down Expand Up @@ -128,6 +129,12 @@ launch_editor(gchar* initial_content, void (*callback)(gchar* content, void* dat
return TRUE;
} else if (pid == 0) {
// Child process: Inherits TTY from parent

// Reset signal handlers that profanity sets so the editor doesn't inherit them
signal(SIGINT, SIG_DFL);
signal(SIGTSTP, SIG_DFL);
signal(SIGPIPE, SIG_DFL);

if (editor_argv && editor_argv[0]) {
execvp(editor_argv[0], editor_argv);
}
Expand Down
2 changes: 2 additions & 0 deletions src/ui/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ ui_reset_idle_time(void)
void
ui_suspend(void)
{
inp_suspend();
endwin();
}

void
ui_resume(void)
{
refresh();
inp_resume();
}

void
Expand Down
19 changes: 18 additions & 1 deletion src/ui/inputwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ static fd_set fds;
static int r;
static char* inp_line = NULL;
static gboolean get_password = FALSE;
static gboolean is_suspended = FALSE;

static void _inp_win_update_virtual(void);
static int _inp_edited(const wint_t ch);
Expand Down Expand Up @@ -172,7 +173,7 @@ char*
inp_readline(void)
{
// UI is suspended
if (isendwin()) {
if (is_suspended || isendwin()) {
g_usleep(100000); // 100ms
return NULL;
}
Expand Down Expand Up @@ -272,6 +273,22 @@ inp_close(void)
discard = NULL;
}

void
inp_suspend(void)
{
is_suspended = TRUE;
rl_callback_handler_remove();
rl_deprep_terminal();
}

void
inp_resume(void)
{
is_suspended = FALSE;
rl_callback_handler_install(NULL, _inp_rl_linehandler);
rl_prep_terminal(0);
}

char*
inp_get_line(void)
{
Expand Down
2 changes: 2 additions & 0 deletions src/ui/inputwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ void create_input_window(void);
void inp_close(void);
void inp_win_resize(void);
void inp_put_back(void);
void inp_suspend(void);
void inp_resume(void);
char* inp_get_password(void);
char* inp_get_line(void);

Expand Down
Loading