Ticket #2530: mc-git20110403-dont-reset-selection-on-gpm-click.diff

File mc-git20110403-dont-reset-selection-on-gpm-click.diff, 1.8 KB (added by vitalif, 14 years ago)

Reset selection only on GPM_DRAG

  • src/editor/edit-widget.h

    diff --git a/src/editor/edit-widget.h b/src/editor/edit-widget.h
    index 18ab9b6..73d51d4 100644
    a b struct WEdit 
    9595    int column1;                /* position of column highlight start */ 
    9696    int column2;                /* position of column highlight end */ 
    9797    long bracket;               /* position of a matching bracket */ 
     98    gboolean mark_dragged;      /* flag to save if mouse was dragged to select something */ 
    9899 
    99100    /* cache speedup for line lookups */ 
    100101    int caches_valid; 
  • src/editor/editwidget.c

    diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c
    index 9a49bed..efc16db 100644
    a b edit_event (Gpm_Event * event, void *data) 
    159159        goto update; 
    160160    } 
    161161 
    162     /* A lone up mustn't do anything */ 
    163     if (edit->mark2 != -1 && event->type & (GPM_UP | GPM_DRAG)) 
    164         return MOU_NORMAL; 
    165  
    166162    if (event->type & (GPM_DOWN | GPM_UP)) 
    167163        edit_push_key_press (edit); 
    168164 
    edit_event (Gpm_Event * event, void *data) 
    195191        edit_move_to_prev_col (edit, edit_bol (edit, edit->curs1)); 
    196192 
    197193    if (event->type & GPM_DOWN) 
     194        edit->mark_dragged = FALSE; /* reset dragged flag */ 
     195 
     196    if ((event->type & GPM_DRAG) && !edit->mark_dragged) 
    198197    { 
    199         edit_mark_cmd (edit, 1);        /* reset */ 
    200         edit->highlight = 0; 
     198        edit_mark_cmd (edit, 1); /* clear selection */ 
     199        edit_mark_cmd (edit, 0); /* begin selection */ 
     200        edit->mark_dragged = TRUE; 
    201201    } 
    202  
    203     if (!(event->type & GPM_DRAG)) 
    204         edit_mark_cmd (edit, 0); 
     202    else if ((event->type & GPM_UP) && edit->mark_dragged) 
     203        edit_mark_cmd (edit, 0); /* end selection */ 
    205204 
    206205  update: 
    207206    edit_find_bracket (edit);