dabo Commit
Revision 4528
Date: 2008-09-25 10:38:31 -0700 (Thu, 25 Sep 2008)
Author: Nate
Trac: http://svn.dabodev.com/trac/dabo/changeset/4528

Changed:
U   trunk/dabo/ui/uiwx/dEditor.py

Log:
Fixed the goNextBookMark and goPrevBookMark function.  The mask trouble was 
that the marker identifier is really a bit in a marker mask.  Since, _bmkPos 
was 5, it was the 5th bit which corresponds to the integer value 32.  So, by 
doing a left shift on the marker, we can get the proper mask.
Also, fixed the issue with zero based line numbers and the line number being 
off by one.  Furthermore, if there was a marker on the line, we had to move to 
the next line to search otherwise MarkerNext would return the line to search 
from.

Diff:
Modified: trunk/dabo/ui/uiwx/dEditor.py
===================================================================
--- trunk/dabo/ui/uiwx/dEditor.py       2008-09-25 16:24:01 UTC (rev 4527)
+++ trunk/dabo/ui/uiwx/dEditor.py       2008-09-25 17:38:31 UTC (rev 4528)
@@ -434,8 +434,8 @@
                except KeyError:
                        pass
                self._saveBookmarks()
-
-
+       
+       
        def clearAllBookmarks(self):
                """Removes all bookmarks."""
                self.MarkerDeleteAll(self._bmkPos)
@@ -449,34 +449,35 @@
                the current line. If there are no more bookmarks, nothing
                happens.
                """
-               ### NOT WORKING! GOTTA FIGURE OUT THE MASK STUFF!  ###
                if line is None:
                        line = self.LineNumber
-#              print "START LN", line
-               nxtLine = self.MarkerNext(line, self._bmkPos)
-#              print "NEXT LN", nxtLine
+               line -= 1 #need Zero Based Line Number
+               if self.MarkerGet(line):
+                       line += 1
+               nxtLine = self.MarkerNext(line, 1 << self._bmkPos)
+               
                if nxtLine > -1:
                        self.moveToEnd()
-                       self.LineNumber = nxtLine
-               
-               
+                       self.LineNumber = nxtLine + 1
+       
+       
        def goPrevBookMark(self, line=None):
                """Moves to the previous bookmark in the document. If the
                line to start searching from is not specified, searches from
                the current line. If there are no more bookmarks, nothing
                happens.
                """
-               ### NOT WORKING! GOTTA FIGURE OUT THE MASK STUFF!  ###
                if line is None:
                        line = self.LineNumber
-               print "START LN", line
-               nxtLine = self.MarkerPrevious(line, self._bmkPos)
-               print "PREV", nxtLine
+               line -= 1 #need Zero Based Line Number
+               if self.MarkerGet(line):
+                       line -= 1
+               nxtLine = self.MarkerPrevious(line, 1 << self._bmkPos)
                if nxtLine > -1:
                        self.moveToEnd()
-                       self.LineNumber = nxtLine
-               
+                       self.LineNumber = nxtLine + 1
        
+       
        def getCurrentLineBookmark(self):
                """Returns the name of the bookmark for the current
                line, or None if this line is not bookmarked.




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to