2012-08-15 15:55 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbide/edit.prg
    ! Fixed: a nasty side-effect of pair-matching; weired editing behaviour.
       Now another click will clear the matching but keeping the cursor
       position at its previous row/column. You may need to click twice 
       to place cursor at desired position if matched/pair is active.
This commit is contained in:
Pritpal Bedi
2012-08-15 22:58:27 +00:00
parent 85fad9905c
commit cfb59dc270
2 changed files with 14 additions and 9 deletions

View File

@@ -16,6 +16,13 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-08-15 15:55 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/edit.prg
! Fixed: a nasty side-effect of pair-matching; weired editing behaviour.
Now another click will clear the matching but keeping the cursor
position at its previous row/column. You may need to click twice
to place cursor at desired position if matched/pair is active.
2012-08-15 14:17 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/edit.prg
+ Added: class/endclass, function|procedure|method/return to control

View File

@@ -1827,17 +1827,15 @@ STATIC FUNCTION hbide_matchBackward( qCursor, cStartingW, cEndingW, qPairFormat
/*----------------------------------------------------------------------*/
METHOD IdeEdit:unmatchPair()
LOCAL lModified, qCursor
LOCAL lModified
IF ::isMatchingPair
qCursor := ::qEdit:cursorForPosition( QPoint( ::qEdit:cursorRect():x(), ::qEdit:cursorRect():y() ) )
::isMatchingPair := .F.
lModified := ::qEdit:document():isModified()
::qEdit:undo()
IF ! lModified
::qEdit:document():setModified( .F. )
ENDIF
::qEdit:setTextCursor( qCursor )
ENDIF
RETURN NIL
@@ -1851,20 +1849,20 @@ METHOD IdeEdit:matchPair( x, y )
qCursor := ::qEdit:cursorForPosition( ::qEdit:viewport():mapFromGlobal( QPoint( x,y ) ) )
IF ! qCursor:isNull()
qCursor:beginEditBlock()
nPostn := qCursor:position()
qFormat := QTextCharFormat()
qFormat:setBackground( QBrush( QColor( Qt_yellow ) ) )
qCursor:select( QTextCursor_WordUnderCursor )
cWord := Lower( qCursor:selectedText() )
IF AScan( { "if","endif","for","next","switch","endswitch","do","enddo","endcase","return","function","procedure","method","class","endclass" }, {|e| e == cWord } ) > 0
::isMatchingPair := .T.
qFormat := QTextCharFormat()
qFormat:setBackground( QBrush( QColor( Qt_yellow ) ) )
lModified := ::qEdit:document():isModified()
qCursor:beginEditBlock()
nPostn := qCursor:position()
SWITCH cWord
CASE "if" /* Forward search */
qCursor:mergeCharFormat( qFormat )