Ticket #3754: 3754-Help-dialog-doesnt-handle-tabs-correctly.patch

File 3754-Help-dialog-doesnt-handle-tabs-correctly.patch, 1.7 KB (added by mooffie, 7 years ago)
  • src/help.c

    From ea1d46bc0443b0df5d3d7ee8832d60b328dbfaca Mon Sep 17 00:00:00 2001
    From: Mooffie <mooffie@gmail.com>
    Date: Tue, 10 Jan 2017 02:07:03 +0200
    Subject: [PATCH] Ticket #3754: Help dialog doesn't handle tabs correctly.
    
    Upon seeing a tab, the help viewer effectively pushes the *current* word
    forward.
    
    Instead, it should first finish handling the current word (that is, print it on
    screen) and only then adjust the column.
    
    Signed-off-by: Mooffie <mooffie@gmail.com>
    ---
     src/help.c | 22 +++++++++++++---------
     1 file changed, 13 insertions(+), 9 deletions(-)
    
    diff --git a/src/help.c b/src/help.c
    index eecb932..ccdbb94 100644
    a b help_show (WDialog * h, const char *paint_start) 
    531531                line++; 
    532532                col = 0; 
    533533                break; 
    534             case '\t': 
    535                 col = (col / 8 + 1) * 8; 
    536                 if (col >= HELP_WINDOW_WIDTH) 
    537                 { 
    538                     line++; 
    539                     col = 8; 
    540                 } 
    541                 break; 
    542534            case ' ': 
     535            case '\t': 
    543536                /* word delimiter */ 
    544537                if (painting) 
    545                     help_print_word (h, word, &col, &line, TRUE); 
     538                { 
     539                    help_print_word (h, word, &col, &line, c == ' '); 
     540                    if (c == '\t') 
     541                    { 
     542                        col = (col / 8 + 1) * 8; 
     543                        if (col >= HELP_WINDOW_WIDTH) 
     544                        { 
     545                            line++; 
     546                            col = 8; 
     547                        } 
     548                    } 
     549                } 
    546550                break; 
    547551            default: 
    548552                if (painting && (line < help_lines))