Easier Rollback for edits



  • Sometimes my code breaks my program and I have to revert to an earlier version. Comparing old code to new while searching for the bad code is sometimes difficult even using the compare plug-in. It would be ideal if any new code entered could be automatically identified in some way (different color, line tokens, etc.). Once the new code is proven reliable to my satisfaction I could clear all the identifiers and start anew. Does this sound like a reasonable request? How do others deal with this or am I missing a feature fitting this description? I’m aware I can put a token next to a line number but ideally it would appear automatically whenever I edit the line, and then later I could “clear all tokens”.



  • Terse reply, on mobile. Location Navigate plugin does this but I’ve never got it to work without force crashing N++ on exit. Others have had more success.

    Cheers.



  • Yes, thumbs up for Location Navigate plugin’s ability to mark changed lines – it puts a colored symbol in the margin for changed lines and then changes the color when you save.



  • But, Location Navigate is 32-bit only, and as was stated, it won’t work for everyone.

    I would absolutely love to have this killer feature be native to Notepad++, or even better, to Scintilla itself.



  • Thanks a lot for the suggestion. I tried it out but it didn’t behave as expected or desired. The text was highlighted making it very difficult to read in my current color preferences (white text, black background). I wish it was more discreet and less intrusive. I fooled around with the various options but couldn’t get them to work properly (32-bit problem?). Maybe I’ll dredge up one of my old text editors and see if it has something similar or more functional.



  • @Moon-Watcher

    Sorry if this sounds harsh, but you are basically saying that clicking the MarkColor and choosing a color which fits your need is too complicated?

    3a320af5-1c16-4a03-b532-57e481f5fbd5-image.png



  • @Moon-Watcher said in Easier Rollback for edits:

    automatically identified in some way (different color, line tokens, etc.)

    The text was highlighted making it very difficult to read

    My earlier comment was clearly in regards to “line tokens”, which is much less intrusive than changed colors on every bit of changed text. That would be too “heavy” for me, and apparently is for the OP as well. Perhaps the OP didn’t consider that possibility before asking, and even the slightest color change, if reconfigured from the default, would be too much (I know it would be for me).



  • For me, Notepad ++ crashes a lot because of the Location Navigate plugin



  • @andrecool-68 said in Easier Rollback for edits:

    Notepad ++ crashes a lot because of the Location Navigate

    Yes, I’ve heard of this. Obviously I’m in the camp where it doesn’t crash. Maybe it works for 50% of people? I don’t know; no real data.

    It’s sort of like the Hex Editor plugin; works for some (50%?). For me, Hex Editor crashes.

    But I’d rather have Location Navigate than Hex Editor (I can obtain a hex editor outside of Notepad++). But someday, perhaps, LN’s change marks will be an integral feature of Scintilla and will work for everyone. The other features of LN, indeed its primary features, aren’t really Scintilla-related, but are more Notepad++ -related, so there would actually be some substantial N++ code work to be done to support that.

    Note: I’m just random rambling…



  • @Alan-Kilborn said in Easier Rollback for edits:

    Note: I’m just random rambling…

    Good ideas though. Hex Editor works fine for me the few times I actually use it, but like you said, I too would rather have LocationNavigate working (x64 too by the way) than Hex Editor.

    I looked at Location Navigate code and was trying to port it to x64 and it loads fine for me and does the changes but when I save it crashes. Even with the original on 32-bit, it seems to run fine and do everything as advertised, but when I close N++, I get a Windows error popup saying the application crashed. Disabling Location Navigate plugin fixes the error.

    I created a little NppExec script show how Location Navigate does its markings:

    NPP_CONSOLE keep
    SET LOCAL MARKTYPE = change
    
    IF "$(ARGC)"=="0" THEN
        INPUTBOX "Choice of:  change, save, clear" : "Choice" :
        IF "{$(INPUT)}"=="{}" GOTO END
        ENDIF
        SET LOCAL MARKTYPE = $(INPUT)
    ENDIF
    IF "$(ARGC)">="2" THEN
        SET LOCAL MARKTYPE = $(ARGV[1])
    ENDIF
    
    SCI_SENDMSG SCI_SETMARGINTYPEN 4 SC_MARGIN_SYMBOL
    //SCI_SENDMSG SCI_SETMARGINTYPEN 10 SC_MARGIN_SYMBOL
    //SCI_SENDMSG SCI_SETMARGINTYPEN 11 SC_MARGIN_SYMBOL
    SCI_SENDMSG SCI_SETMARGINWIDTHN 4 4
    SCI_SENDMSG SCI_SETMARGINMASKN 4 3072
    
    SCI_SENDMSG SCI_MARKERSETFORE 10 8831743
    SCI_SENDMSG SCI_MARKERSETFORE 11 11927477
    SCI_SENDMSG SCI_MARKERSETBACK 10 8831743
    SCI_SENDMSG SCI_MARKERSETBACK 11 11927477
    SCI_SENDMSG SCI_MARKERDEFINE 10 SC_MARK_FULLRECT
    SCI_SENDMSG SCI_MARKERDEFINE 11 SC_MARK_FULLRECT
    
    IF "$(MARKTYPE)"~="change" THEN
        SCI_SENDMSG SCI_MARKERDELETE $(CURRENT_LINE) 11
        SCI_SENDMSG SCI_MARKERADD $(CURRENT_LINE) 10
    ELSE IF "$(MARKTYPE)"~="save" THEN
        SCI_SENDMSG SCI_MARKERDELETE $(CURRENT_LINE) 10
        SCI_SENDMSG SCI_MARKERADD $(CURRENT_LINE) 11
    ELSE IF "$(MARKTYPE)"~="clear" THEN
        SCI_SENDMSG SCI_MARKERDELETE $(CURRENT_LINE) 10
        SCI_SENDMSG SCI_MARKERDELETE $(CURRENT_LINE) 11
    ELSE IF "$(MARKTYPE)"~="off" THEN
        SCI_SENDMSG SCI_MARKERDELETE $(CURRENT_LINE) 10
        SCI_SENDMSG SCI_MARKERDELETE $(CURRENT_LINE) 11
        SCI_SENDMSG SCI_SETMARGINTYPEN 4 0
        SCI_SENDMSG SCI_SETMARGINWIDTHN 4 0
    ENDIF
    
    :END
    

    Of course this only demonstrates manually, it doesn’t actually track changes the way the Location Navigate plugin does automatically.

    Cheers.



  • @Michael-Vincent said in Easier Rollback for edits:

    trying to port it to x64 … but when I save it crashes

    I like what you’re trying to do! I presume you’ve run under the debugger, set some “strategic” (i.e., guesses at where to locate) breakpoints, and single-stepped to maybe isolate the cause of the crash?

    Location Navigate and Explorer plugins might be the only things keeping me in N++ 32-bit land.



  • @Alan-Kilborn

    I have not run in debugger - I’m not that talented a C++ programmer. If you are and want to look:
    https://github.com/vinsworldcom/nppLocationNavigate

    For Explorer on N++ 64-bit, I use:
    https://github.com/funap/npp-explorer-plugin

    I like it better than the one in Plugin Admin:
    https://github.com/oviradoi/npp-explorer-plugin



  • @Michael-Vincent This is the way it should be so many warnings … or did I do something wrong?

        1>------ Build started: Project: LocationNavigate, Configuration: Release x64 ------
        1>LNhistoryDlg.cpp
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.h(136): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.h(140): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.cpp(69): warning C4267: 'initializing': conversion from 'size_t' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.cpp(76): warning C4244: 'initializing': conversion from 'LRESULT' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.cpp(94): warning C4244: 'initializing': conversion from 'LRESULT' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.cpp(99): warning C4244: 'initializing': conversion from 'LRESULT' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.cpp(102): warning C4244: 'initializing': conversion from 'LRESULT' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.cpp(228): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
        1>SelfCtrl.cpp
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\selfctrl.cpp(119): warning C4244: 'initializing': conversion from 'LONG_PTR' to 'DWORD', possible loss of data
        1>StaticDialog.cpp
        1>LocationNavigate.cpp
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.h(136): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.h(140): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(103): warning C4244: 'initializing': conversion from 'LRESULT' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(227): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(236): warning C4267: 'initializing': conversion from 'size_t' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(251): warning C4267: 'initializing': conversion from 'size_t' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(284): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(301): warning C4244: '=': conversion from 'LRESULT' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(316): warning C4267: 'initializing': conversion from 'size_t' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(416): warning C4244: 'initializing': conversion from 'LRESULT' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(447): warning C4100: 'lpParam': unreferenced formal parameter
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(526): warning C4244: 'initializing': conversion from 'LRESULT' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(528): warning C4244: '=': conversion from 'LRESULT' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(543): warning C4244: '=': conversion from 'LRESULT' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(583): warning C4244: '=': conversion from 'LRESULT' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(664): warning C4244: 'initializing': conversion from 'LRESULT' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(676): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(730): warning C4244: 'initializing': conversion from 'LRESULT' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(763): warning C4100: 'lpReserved': unreferenced formal parameter
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1035): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1068): warning C4244: '=': conversion from 'uptr_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1117): warning C4244: 'initializing': conversion from 'LRESULT' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1172): warning C4244: '=': conversion from 'uptr_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1246): warning C4244: '=': conversion from 'Sci_Position' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1247): warning C4244: '=': conversion from 'Sci_Position' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1253): warning C4244: '=': conversion from 'Sci_Position' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1254): warning C4244: '=': conversion from 'Sci_Position' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1282): warning C4311: 'type cast': pointer truncation from 'HWND' to 'int'
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1282): warning C4302: 'type cast': truncation from 'HWND' to 'int'
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1325): warning C4244: '=': conversion from 'LRESULT' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1332): warning C4244: '=': conversion from 'LRESULT' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1333): warning C4244: 'argument': conversion from 'Sci_Position' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1339): warning C4244: '=': conversion from 'Sci_Position' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1345): warning C4244: 'initializing': conversion from 'LRESULT' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1347): warning C4244: 'argument': conversion from 'Sci_Position' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1378): warning C4100: 'lParam': unreferenced formal parameter
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1378): warning C4100: 'wParam': unreferenced formal parameter
        1>c:\users\uzzer\desktop\npplocationnavigate-master\locationnavigate.cpp(1377): warning C4100: 'Message': unreferenced formal parameter
        1>PluginDefinition.cpp
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.h(136): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\dockingfeature\lnhistorydlg.h(140): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\plugindefinition.cpp(339): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\plugindefinition.cpp(355): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
        1>c:\users\uzzer\desktop\npplocationnavigate-master\plugindefinition.cpp(396): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
        1>   Creating library LocationNavigate.lib and object LocationNavigate.exp
        1>Generating code
        1>All 386 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
        1>Finished generating code
        1>LocationNavigate.vcxproj -> C:\Users\Uzzer\Desktop\nppLocationNavigate-master\.\bin64\LocationNavigate.dll
        1>Done building project "LocationNavigate.vcxproj".
        ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


  • @andrecool-68
    They need to be fixed. That’s all 32-bit fine but 64-bit broke as I understand it.



  • I meant to reply with this much earlier in the chain, for those that might not know the capability Location Navigate supplies as far as marking changed lines goes:

    78d1e63c-5ebf-471c-b3a1-b2178fb0fd1a-image.png



  • @Ekopalypse Not at all. My point was that I found the highlighting of the text too distracting. However thanks to you and @Alan-Kilborn posting those pictures I found the options menu I hadn’t seen before. Wow! This is EXACTLY what I was looking for! Actually, it’s even better. I’ve been using notepad++ for 9 years and this plug-in will save me hundreds of hours of trouble-shooting.

    Thanks to everyone who responded to my query. It’s really fantastic how helpful everyone is in this forum.



  • @Michael-Vincent Thank you for the information. This will save me countless hours of frustration in the future. Where do I send the check?



  • @Moon-Watcher said in Easier Rollback for edits:

    Where do I send the check beer?

    Your welcome.


Log in to reply