Skip to content

Crashes on wide terminals #1

@quadrillion

Description

@quadrillion

When the terminal is too wide (probably more than about 250), pfqueue crashes when trying to display the interface. The issue appears to be improper arguments to mvwinnstr in show_cursor(). The last argument should be BUF_SIZE, not COLS.
Here is my patch (which also increases BUF_SIZE for wide terminals):

diff --git a/frontends/pfq_fencurses.c b/frontends/pfq_fencurses.c
index d6f53e3..958dc19 100644
--- a/frontends/pfq_fencurses.c
+++ b/frontends/pfq_fencurses.c
@@ -18,7 +18,7 @@
 #include "pfq_fencurses.h"

 #define CAT_BUF_SIZE 20*1024
-#define BUF_SIZE 250
+#define BUF_SIZE 1024

 char *a_names[]={
        "hold",
@@ -485,7 +485,7 @@ void show_cursor() {

        // Current row
        i = msg_at(CURROW);
-       mvwinnstr ( lwnd, CURROW, 0, buf, COLS );
+       mvwinnstr ( lwnd, CURROW, 0, buf, BUF_SIZE );

        if ( pfql_getstatus(pfql_ctx)->use_colors )
                wattron ( lwnd, COLOR_PAIR(CP_MSG) );
@@ -504,7 +504,7 @@ void show_cursor() {
        // Previous row
        if ( PREVROW!=CURROW ) {
                i = msg_at(PREVROW);
-               mvwinnstr ( lwnd, PREVROW, 0, buf, COLS );
+               mvwinnstr ( lwnd, PREVROW, 0, buf, BUF_SIZE );
                msg = pfql_msg_at(pfql_ctx,i);
                if ( msg ) {
                        if ( msg->tagged )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions