mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-22 01:40:17 -05:00
parent
67bd5dd460
commit
e38ec79be1
7 changed files with 99 additions and 1 deletions
17
osc.c
17
osc.c
|
|
@ -8,7 +8,7 @@
|
|||
#include <sys/epoll.h>
|
||||
|
||||
#define LOG_MODULE "osc"
|
||||
#define LOG_ENABLE_DBG 0
|
||||
#define LOG_ENABLE_DBG 1
|
||||
#include "log.h"
|
||||
#include "base64.h"
|
||||
#include "config.h"
|
||||
|
|
@ -64,6 +64,14 @@ osc_to_clipboard(struct terminal *term, const char *target,
|
|||
return;
|
||||
}
|
||||
|
||||
const bool copy_allowed = term->conf->security.osc52 == OSC52_ENABLED
|
||||
|| term->conf->security.osc52 == OSC52_COPY_ENABLED;
|
||||
|
||||
if (!copy_allowed) {
|
||||
LOG_DBG("ignoring copy request: disabled in configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
char *decoded = base64_decode(base64_data, NULL);
|
||||
if (decoded == NULL) {
|
||||
if (errno == EINVAL)
|
||||
|
|
@ -190,6 +198,13 @@ osc_from_clipboard(struct terminal *term, const char *source)
|
|||
return;
|
||||
}
|
||||
|
||||
const bool paste_allowed = term->conf->security.osc52 == OSC52_ENABLED
|
||||
|| term->conf->security.osc52 == OSC52_PASTE_ENABLED;
|
||||
if (!paste_allowed) {
|
||||
LOG_DBG("ignoring paste request: disabled in configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Use clipboard if no source has been specified */
|
||||
char src = source[0] == '\0' ? 'c' : 0;
|
||||
bool from_clipboard = src == 'c';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue