How about the bookmark's usage?

Developers
liyinghui
2004-04-19
2004-04-20
  • liyinghui

    liyinghui - 2004-04-19

    I don't know how to use bookmark, can any one explain it?

     
    • Daniel Pozmanter

      why post that here?  Do you mean how do you fiddle with the source?

      Using bookmarks is easy.  You add a bookmark "Edit Bookmarks".

      You then select a file or directory.  If it is a file,
      DrPython opens that file in the editor.

      If it is a directory, DrPython sets the open dialog to that directory, then launches it.

       
    • liyinghui

      liyinghui - 2004-04-19

      Oh, I see. I thought that when I reading some code, I need to read other place up or down, and then go back again. In order to move quickly, I can use bookmark to set a point , and when I want to go back, I can select the bookmark which I just setted, then I'll go back quickly where I want.

      But the bookmark in DrPython is not like what I thought.

       
    • Daniel Pozmanter

      That is how Pype handles bookmarks.

      I use bookmarks the way mozilla does.

      It would certaintly be simple enough to add something like codemarks, and have it do exactly what you say.
      (You could specify whether a codemark takes you to the exact line, or the exact position, and save codemarks in the session (or likely project, if that is implemented at that point)).

      What thoughts?

       
    • liyinghui

      liyinghui - 2004-04-19

      I think codemark will fit me. If it can be an item of to do list? If there are some shortcut may be very convenience, just F4 next codemark, Shfit-F4 previous codemark. And some icons display in the line number area .

       
    • Chris Wilson

      Chris Wilson - 2004-04-19

      I've found the bookmarks feature to be really handy, expecially when swapping between projects, and t's always handy to have one set to the Python "site-packages" folder. But I agree with limodou, the term "bookmark" in text editing software normally refers to page/point in a document. I suppose with a browser, it works as Dan says, and it's still a point in a document. Suppose it depends upon your point of view.

      Codemarks would be handy, and with some minor additions, could be used to implement a to-do list/notes feature. I actually had something like this in mind for after the project manager features, as to implement them properly requires storage of additional persistent information such as would be added to the project file.

      For now, a simple codemark feature that would be handy, especially for future development:

      - As the user edits the document which contains a codemark, it should move as text is inserted/deleted earlier in the document, so as to ensure it still points to the same place. If a section of code to which a bookmark points is deleted, the codemark should also be deleted, possibly prompting the user to confirm.

      The following additional features would allow a basic, but still very userful "to-do list" to be implemented:

      - Allow the user to enter a comment for each codemark, probably in a seperate window/pane.
      - There should be some form of visible indication in the document showing where there is a codemark.
      - Allow the user to go directly to the associated comment when their cursor is on the codemark indicator.
      - Add a simple "manage codemark" dialog to allow viewing, adding, editing and deleting of codemarks.

      Until the project management features are impemented (which I hope to do this week) this proposed extended use of codemarks will be of very little use as the information will not be stored anywhere for recall.

       
    • Daniel Pozmanter

      Any thoughts on the performance cost of keeping track of codemarks?  DrPython does not keep track of breakpoints at th moment (does anyone ever use the python debugger?)

       
    • Chris Wilson

      Chris Wilson - 2004-04-19

      Always thought debuggers were a good idea, but in 20+ years of coding, I've never used one yet. Now I'm using Python extensively, it's just easier to use the interactive prompt and drop in debug message. That said, there are a lot of people out there that swear by them. Hard to say whether I'm wierd, or they are.

      Wouldn't imagine keeping track of codemarks would have much of an overhead. Storing them in a simple list, each time the time the number of lines in the document changed you could trigger check which would identify the line changed/deleted and depending on whether the codemark line is after the change, adjust the line position. It'll get slightly more complicated when you consider changes to selected blocks, but not that much more so.

      Adding the comment would just be a case of making it a list of integer/string tuples, and the management feature would only need to be a simple listbox dialog.

       
    • liyinghui

      liyinghui - 2004-04-19

      I seldom use python debugger, simply using print. But the codemark had better be stored in someplace, so when openning the file, I could very quickly go back the last place I had worked with.

       
    • Daniel Pozmanter

      Yeah, I don't use debugger either.  At most I use print statements (in c++ I use to use loggers quite a bit, but that is hardly necessary with an interpreted language.)

      Makes me wonder if I should remove loggers altogether.

      In any case, yes, the codemarks should be stored.
      I am wondering whether the performance cost of shuffling them around when the user edits text is too much.  I mean, I would have to handle adding lines,
      remvoing lines, cut and paste, etc.

      Perhaps we should call them linemarks?

       
    • Chris Wilson

      Chris Wilson - 2004-04-20

      I'd say line based codemarks would be sufficient resolution.

      The handling would be very straight-forward, as pressing return, deleting a single line, cutting, pasting, deleting a block etc. all change the number of lines in the document, and the only thing time you need to consider shuffling the codemarks is when the number of lines changes.

      You can therefore code a single simple routine, triggered by a change in the number of lines in the document to handle shuffling the bookmarks around. The pseudocode is as follows:

      change = document.line_count - old_line_count
      if change != 0:
          for codemark in codemark_list:
              if codemark.line >= current_cursor_line:
                  codemark.line += change
      old_line_count = document.line_count

      That's it. Very little processing, or testing required with it being such a piece of code.

       
    • Chris Wilson

      Chris Wilson - 2004-04-20

      Damn this forum. It's removed the leading spaces in my pseudocode. You get the idea though.

       
    • Chris Wilson

      Chris Wilson - 2004-04-20

      No. Sorry, but it's really going to bug me seeing the code like that. Let's try this:

      change = document.line_count - old_line_count
      if change != 0:
      ....for codemark in codemark_list:
      ........if codemark.line >= current_cursor_line:
      ............codemark.line += change
      old_line_count = document.line_count

      Ugly. But I'll sleep more soundly tonight now that's done.

       
    • Chris Wilson

      Chris Wilson - 2004-04-20

      When it comes to storing the codemarks, I'll include provision for it in the soon-to-be-posted project manager specifications. The project file will have provision for such things, and much more besides.

      I've had an insanely busy day, so it'll probably be tomorrow before I post the specification for discussion. Actually, knowing me, I'll probably write the specification after I've coded a rough version, so you may just get that instead. Assuming tomorrow is somewhat quieter than today.

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks