Behavior of GotoBookMark command

Behavior of GotoBookMark command


    Dec 06, 2012#1

    I am new to this software, but I was attempting to create a macro that would go to a bookmarked line and uncomment the line by removing a * from the beginning. When I use the GotoBookMark command it wants an index number that seems to be difficult to find. Does the bookmark index exist anywhere? I don't see it in the bookmark viewer. I think, I have determined that the index is in the order the bookmarks are created starting with 0.

    The "GotoBookMark 0" command works as expected. When I use "GotoBookMark 1" I actually get either bookmark 0 or 1 as I cycle through the Play Again macro command. When I use "GotoBookMark 2" I actually get either bookmark 0 or 2 as I cycle through the Play Again macro command. It seems this GotoBookMark command wants to always cycle through bookmark 0. How to prevent this? I would like use GotoBookMark 2 and it always go to bookmark 2 and not cycle between 0 and 2.

    Macro Code:
    GotoBookMark 2

    Grand MasterGrand Master

      Dec 06, 2012#2

      The help of UltraEdit contains the page Edit Macro command which explains the command GotoBookMark as follows:

      Parameter: Index of bookmark to jump to or -1 to go to next bookmark

      Description: Jump to the next/specified bookmark. The indexes start with 0. If a user enters an index that is greater than the actual number of bookmarks then it is automatically directed to the first bookmark (index 0).

      Well, this explanation is not complete and of course also no correct.

      GotoBookMark -1 is like using Search - Bookmarks - Next Bookmark. That's easy.

      When using a bookmark index the behavior is more difficult to understand.

      The bookmarks are indexed starting with 0 simply by their existence from top to bottom. For example if you set a bookmark first on line 5, next on line 20 and last on line 12, the bookmark on line 5 has index 0, the bookmark on line 12 has index 1 and the bookmark on line 20 has index 2. If the bookmark on line 12 is removed, the bookmark on line 5 has still index 0, but the bookmark on line 20 has now index 1.

      If GotoBookMark 2 is used and the active file has at least 3 bookmarks, the caret is moved to the third bookmarked line. But there is one exception. If the caret is already at third bookmarked line, the caret is moved to first bookmarked line. I don't know the reason for this exception. It does not really make sense for me. I don't have any idea how to prevent the positioning of the caret on first bookmarked line if caret is already on correct bookmarked line.

      If GotoBookMark 5 is used, but the active file has for example only 3 lines bookmarked, the command is interpreted like GotoBookMark -1 which means like executing Next Bookmark. So the description is wrong for this error scenario.

      I will send a report to IDM about wrong description and also find out if a too large bookmark index resulted also in older versions of UltraEdit in a Next Bookmark behavior.