Menu

#60 tagstack

open
nobody
None
5
2020-12-21
2002-07-30
TK Soh
No

This is a patch to add vim-like tagstack capability to
NEdit. When you make a successful call to "Find
Definition", the current window position is pushed into
a LIFO stack before make jump, where you can later
return the position by popping the tagstack.

Discussion

1 2 > >> (Page 1 of 2)
  • TK Soh

    TK Soh - 2002-07-30

    patch v1 for 5.3. original release

     
  • TK Soh

    TK Soh - 2002-07-30

    readme for tagstack patch v1

     
  • Nathan Gray

    Nathan Gray - 2002-07-31

    Logged In: YES
    user_id=121553

    I like the idea a lot -- in fact, I do this already with a set
    of macros and the mark functions. I'd like to see it
    built-in, though, since my way is pretty awkward to set
    up and has its shortcomings (only 10 locations and
    potential interation problems with other macros).

    I'd actually like to see it go further. I'd like the option of
    making more of the search operations push to the
    tagstack. I often need to search for a definition then
    return to my location, and I always forget to set a mark
    before I do the search.

    Really, I'd love to see a browser-like history, which
    wouldn't be so much more difficult than a stack, but first
    things first...

     
  • TK Soh

    TK Soh - 2002-07-31

    Logged In: YES
    user_id=411637

    I forgot to mention explicitly this tagstack is cross-window.

    bookmarks are currently local to windows, so it won't work
    most of the time, especially on serious projects using
    modular languages.

    on pushing the search operations, I guess might be better to
    maintain a separate stack, else it might make the tagstack a
    bit too crowded and probably confusing. hmm...

    I had done some experiment with the history list, but put it
    aside after awhile. maybe I should look at it again.

     
  • Arne F�rlie

    Arne F�rlie - 2002-08-04

    Logged In: YES
    user_id=75224

    I have actually implemented the same functionality, but I
    never got around to provide a proper patch. If your patch is
    included I'll be happy to scrap my work.

    I have a few nitpicks:
    - in menu.c you shouldn't provide the 'pop-tagstack' and
    'clear-tagstack' action routines. New action routines should
    use underscore, and existing action routines with dashes are
    only there for backward compatibility.

    - in tags.c you have defined a static function
    normalizePathname, but not provided a definition for it.

     
  • TK Soh

    TK Soh - 2002-08-05

    Logged In: YES
    user_id=411637

    AFAIK, YunLiang Yu also had done some work on it awhile
    back, but it was never 'officially' released. And I didn't
    want to wait.

    Please don't scrap your patch, submit it. I am sure there
    are things we can learn from each other. To me, it was never
    about competition.

    Now only I've come to understand why there are two flavors
    of action routine names. Thanks for the information.

    Patch v1.1 has the clean up.

     
  • TK Soh

    TK Soh - 2002-08-05

    tagstack patch v1.1 for 5.3. with housekeeping

     
  • TK Soh

    TK Soh - 2003-04-03

    v 1.2: updated to CVS -D 27-Mar-03

     
  • Scott Tringali

    Scott Tringali - 2004-07-01

    Logged In: YES
    user_id=11321

    I do like the idea, but it's hard for me to weigh an opinion here without adding the patch and trying it.

    Maybe if we could write up a UI spec, that describes all the new user-visible functionality (just a few paragraphs, really) for this. E.g., how do I "return to the position"? Is there a web-browser like "Back" button?

    Then we can discuss on the group what a good UI will be for this, before it hits CVS. Otherwise, the UI tends to churn a lot in code. The idea is to churn the UI with words first.

     
  • TK Soh

    TK Soh - 2004-07-02

    Logged In: YES
    user_id=411637

    There's no fancy window or any GUI appearances for now,
    just a plain Shift-Ctrl-D to do the opposite of Ctrl-D, so I
    don't have to run through the long window list to find my way
    back. Quite honestly, I couldn't have written those code as
    fast, if not because of the patch.

    It'd be nice if we could have a more complete design to
    handle tags manipulation. But in some way, it's fixing a bug.

     
  • TK Soh

    TK Soh - 2004-10-26

    updated for NEdit-5.5

     
  • TK Soh

    TK Soh - 2004-10-26

    Logged In: YES
    user_id=411637

    Uploaded patch for NEdit 5.5

     
  • TK Soh

    TK Soh - 2005-05-03

    Logged In: YES
    user_id=411637

    Uploaded tagstack-v1_0.menu - a macro implementation of the
    tagstack feature.

    Two macros are implemented: 'find tag' and 'pop tag', which
    are bound to Ctrl-] and Shift-Ctrl-] respectively.

    Use nedit's -import option to apply the macro, then save the
    default preferences to keep them:

    nedit -import tagstack-v1_0.menu

     
  • TK Soh

    TK Soh - 2005-05-03

    macro v1.0: a macro implementation of tagstack

     
  • Nobody/Anonymous

    this is great!
    is there a way to remap the keys from ctrl+], ctrl+shift+] to ctrl+d, ctrl+shift+d ??

    thanks

     
  • Maxim Yanchenko

    Maxim Yanchenko - 2011-05-09

    v1_2 doesn't work with nedit 5.6 (i.e. the current CVS HEAD) - any chance to have an updated version?

    It should probably be changed to get the new ignoreModify flag into account?

     
  • Anonymous

    Anonymous - 2011-07-01

    the patch is so old that I am not even sure I can update it to HEAD. Beside I'd really recommend you try the macro version. And it's actually a much more portable solution than patching the core. The only issue that NEdit doesn't have good system to import/setup the macros & their menus easily. Have you tried it?

     
  • TK Soh

    TK Soh - 2020-06-21

    Patch updated to NEdit 5.7+

     
  • TK Soh

    TK Soh - 2020-12-16

    FYI, this patch can found on the github branch below:

    https://github.com/tksoh/nedit-git/commits/tagstack

     
  • Evan Teran

    Evan Teran - 2020-12-16

    @tksoh

    I am intrigued by this patch, and think it is a good candidate for porting to nedit-ng, but have a few questions :-).

    1. you said that unlike bookmarks, it is "cross-window", I assume that means that it will activate the appropriate window if you moved away since?

    2. Bookmarks have a mechanism to seemlessly move the bookmark if the text is edited after the bookmark is made. For example if your text buffer just has "Hello world" and you bookmark position 6, it points to the start of "world".

    if you then type some text between the two words, for example, making it "hello friendly world", the bookmark is then seemless adjusted to still point at world.

    Does this tag stack have any similar mechanism?

     

    Last edit: Evan Teran 2020-12-16
    • TK Soh

      TK Soh - 2020-12-17

      On your questions:

      1. when you 'pop' the stack, it will bring up the document/window, and jump to the original position and select the text where the Ctrl-D was pressed, as long as the document is still opened.
      2. when a document is modified, the tagstack data are updated to adjust to the changes. Just like the built-in bookmarks. Even if you insert something within "world", say "wo .... rld", it will still jump back and select "wo .... rld".
       
      👍
      1
    • TK Soh

      TK Soh - 2020-12-17

      Scott originally suggested making a GUI for it. Back then, I wanted to keep it minimalist, and let the menu do the work, since that makes the patch a lot easier to maintain not having to worry about all the corner cases. But perhaps something to think about if we are to port it into nedit-ng.

       
  • Evan Teran

    Evan Teran - 2020-12-17

    @tksok nice!

    it sounds like it works perfectly as one would expect. So regarding GUI/minimalist. My personal opinion is that it's ok to introduce new features with minimalist GUIs because we can always add a nice GUI for the feature after it's in.

    I definitely think this feature would make a nice addition to NG.

     
  • TK Soh

    TK Soh - 2020-12-18

    Perhaps we can start by porting the current implementation into NG, and then work on the GUI along the way as further enhancement?

     
  • Evan Teran

    Evan Teran - 2020-12-19

    @tksoh That's exactly what I was thinking. Since it's a port of your patch efforts, you can take the lead on this effort if you like. I'll be more than happy to help though, especially regarding how the Qt code factors in if you need it.

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

MongoDB Logo MongoDB