Changeset 27581

Show
Ignore:
Timestamp:
11/16/08 20:54:09 (2 months ago)
Author:
vfr
Message:

branch: Make sure the selection painting is updated after LFUN_UP or LFUN_DOWN. See http://thread.gmane.org/gmane.editors.lyx.devel/113428

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lyx-devel/branches/BRANCH_1_6_X/src/Cursor.cpp

    r27225 r27581  
    17031703 
    17041704 
     1705bool Cursor::atFirstOrLastRow(bool up) 
     1706{ 
     1707        TextMetrics const & tm = bv_->textMetrics(text()); 
     1708        ParagraphMetrics const & pm = tm.parMetrics(pit()); 
     1709         
     1710        int row; 
     1711        if (pos() && boundary()) 
     1712                row = pm.pos2row(pos() - 1); 
     1713        else 
     1714                row = pm.pos2row(pos()); 
     1715         
     1716        if (up) { 
     1717                if (pit() == 0 && row == 0) 
     1718                        return true; 
     1719        } else { 
     1720                if (pit() + 1 >= int(text()->paragraphs().size()) && 
     1721                                row + 1 >= int(pm.rows().size())) 
     1722                        return true; 
     1723        } 
     1724        return false; 
     1725} 
     1726 
    17051727bool Cursor::upDownInText(bool up, bool & updateNeeded) 
    17061728{ 
     
    17561778                row = pm.pos2row(pos()); 
    17571779                 
    1758         // are we not at the start or end? 
    1759         if (up) { 
    1760                 if (pit() == 0 && row == 0) 
    1761                         return false; 
    1762         } else { 
    1763                 if (pit() + 1 >= int(text()->paragraphs().size()) && 
    1764                                 row + 1 >= int(pm.rows().size())) 
    1765                         return false; 
    1766         } 
     1780        if (atFirstOrLastRow(up)) 
     1781                return false; 
    17671782 
    17681783        // with and without selection are handled differently 
  • lyx-devel/branches/BRANCH_1_6_X/src/Cursor.h

    r26942 r27581  
    360360        /// return true if fullscreen update is needed 
    361361        bool down(); 
     362        /// whether the cursor is either at the first or last row 
     363        bool atFirstOrLastRow(bool up); 
    362364        /// move up/down in a text inset, called for LFUN_UP/DOWN, 
    363365        /// return true if successful, updateNeeded set to true if fullscreen 
  • lyx-devel/branches/BRANCH_1_6_X/src/Text3.cpp

    r27214 r27581  
    616616                bool select = cmd.action == LFUN_DOWN_SELECT || 
    617617                        cmd.action == LFUN_UP_SELECT; 
    618                 cur.selHandle(select); 
    619618 
    620619                // move cursor up/down 
    621620                bool up = cmd.action == LFUN_UP_SELECT || cmd.action == LFUN_UP; 
    622                 bool const successful = cur.upDownInText(up, needsUpdate); 
    623                 if (successful) { 
    624                         // redraw if you leave mathed (for the decorations) 
     621                bool const atFirstOrLastRow = cur.atFirstOrLastRow(up); 
     622 
     623                if (!atFirstOrLastRow) { 
     624                        needsUpdate |= cur.selHandle(select);    
     625                        cur.selHandle(select); 
     626                        cur.upDownInText(up, needsUpdate); 
    625627                        needsUpdate |= cur.beforeDispatchCursor().inMathed(); 
    626                 } else 
     628                } else { 
     629                        // if the cursor cannot be moved up or down do not remove 
     630                        // the selection right now, but wait for the next dispatch. 
     631                        if (select) 
     632                                needsUpdate |= cur.selHandle(select);    
     633                        cur.upDownInText(up, needsUpdate); 
    627634                        cur.undispatched(); 
     635                } 
    628636 
    629637                break; 
  • lyx-devel/branches/BRANCH_1_6_X/status.16x

    r27510 r27581  
    6565- Fix possible endless loop while running lyx2lyx. 
    6666 
     67- Fix painting update rules after LFUN_UP or LFUN_DOWN in an inset. 
     68 
    6769 
    6870* USER INTERFACE