Merge remote-tracking branch 'upstream/master' into merge/upstream-full

# Conflicts:
#	CONTRIBUTING.md
#	src/profanity.c
#	src/tools/editor.c
This commit is contained in:
2026-04-18 12:26:52 +03:00
6 changed files with 32 additions and 2 deletions

View File

@@ -150,6 +150,8 @@ prof_run(gchar* log_level, gchar* account_name, gchar* config_file, gchar* log_f
if (!background_mode) { if (!background_mode) {
ui_update(); ui_update();
} }
while (g_main_context_iteration(NULL, FALSE))
;
#ifdef HAVE_GTK #ifdef HAVE_GTK
tray_update(); tray_update();
#endif #endif

View File

@@ -17,6 +17,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <pthread.h> #include <pthread.h>
#include <signal.h>
#include "config/files.h" #include "config/files.h"
#include "config/preferences.h" #include "config/preferences.h"
@@ -313,6 +314,12 @@ launch_editor(gchar* initial_content, void (*callback)(gchar* content, void* dat
return TRUE; return TRUE;
} else if (pid == 0) { } else if (pid == 0) {
// Child process: Inherits TTY from parent // 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]) { if (editor_argv && editor_argv[0]) {
execvp(editor_argv[0], editor_argv); execvp(editor_argv[0], editor_argv);
} }

View File

@@ -179,6 +179,7 @@ ui_reset_idle_time(void)
void void
ui_suspend(void) ui_suspend(void)
{ {
inp_suspend();
endwin(); endwin();
} }
@@ -186,6 +187,7 @@ void
ui_resume(void) ui_resume(void)
{ {
refresh(); refresh();
inp_resume();
} }
void void

View File

@@ -65,6 +65,7 @@ static fd_set fds;
static int r; static int r;
static char* inp_line = NULL; static char* inp_line = NULL;
static gboolean get_password = FALSE; static gboolean get_password = FALSE;
static gboolean is_suspended = FALSE;
static void _inp_win_update_virtual(void); static void _inp_win_update_virtual(void);
static int _inp_edited(const wint_t ch); static int _inp_edited(const wint_t ch);
@@ -180,7 +181,7 @@ char*
inp_readline(void) inp_readline(void)
{ {
// UI is suspended // UI is suspended
if (isendwin()) { if (is_suspended || isendwin()) {
g_usleep(100000); // 100ms g_usleep(100000); // 100ms
return NULL; return NULL;
} }
@@ -285,6 +286,22 @@ inp_close(void)
discard = NULL; 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* char*
inp_get_line(void) inp_get_line(void)
{ {

View File

@@ -18,6 +18,8 @@ void create_input_window(void);
void inp_close(void); void inp_close(void);
void inp_win_resize(void); void inp_win_resize(void);
void inp_put_back(void); void inp_put_back(void);
void inp_suspend(void);
void inp_resume(void);
char* inp_get_password(void); char* inp_get_password(void);
char* inp_get_line(void); char* inp_get_line(void);
void inp_set_line(const char* const new_line); void inp_set_line(const char* const new_line);

View File

@@ -117,7 +117,7 @@ session_connect_with_account(const ProfAccount* const account)
auto_char char* jid = NULL; auto_char char* jid = NULL;
if (account->resource) { if (account->resource) {
auto_jid Jid* jidp = jid_create_from_bare_and_resource(account->jid, account->resource); auto_jid Jid* jidp = jid_create_from_bare_and_resource(account->jid, account->resource);
jid = strdup(jidp->fulljid); jid = strdup(jid_fulljid_or_barejid(jidp));
} else { } else {
jid = strdup(account->jid); jid = strdup(account->jid);
} }