all repos — tint2 @ b9310665732074af596772266461d8a6ef1df1b7

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Executor: truncate very long tooltips
o9000 mrovi9000@gmail.com
commit

b9310665732074af596772266461d8a6ef1df1b7

parent

f45e10720723676e8256a0454f33b4e89b99feba

1 files changed, 8 insertions(+), 0 deletions(-)

jump to
M src/execplugin/execplugin.csrc/execplugin/execplugin.c

@@ -18,6 +18,8 @@ #include "panel.h"

#include "timer.h" #include "common.h" +#define MAX_TOOLTIP_LEN 4096 + void execp_timer_callback(void *arg); char *execp_get_tooltip(void *obj); void execp_init_fonts();

@@ -794,6 +796,8 @@ else

start = execp->backend->buf_stderr; execp->backend->tooltip = strdup(start); rstrip(execp->backend->tooltip); + if (strlen(execp->backend->tooltip) > MAX_TOOLTIP_LEN) + execp->backend->tooltip[MAX_TOOLTIP_LEN] = '\0'; } execp->backend->buf_stderr_length = 0; execp->backend->buf_stderr[execp->backend->buf_stderr_length] = '\0';

@@ -811,6 +815,10 @@ if (start) {

start += strlen(ansi_clear_screen); memmove(execp->backend->buf_stderr, start, strlen(start) + 1); execp->backend->buf_stderr_length = (ssize_t)strlen(execp->backend->buf_stderr); + } + if (execp->backend->buf_stderr_length > MAX_TOOLTIP_LEN) { + execp->backend->buf_stderr_length = MAX_TOOLTIP_LEN; + execp->backend->buf_stderr[execp->backend->buf_stderr_length] = '\0'; } execp->backend->tooltip = strdup(execp->backend->buf_stderr); rstrip(execp->backend->tooltip);