Session Manager 0.8, now with global bookmarks!

1 2 > >> (Page 1 of 2)
  • Mike Foster

    Mike Foster - 2014-10-06

    Session Manager 0.8, now with global bookmarks!

    NPP saves a file's bookmarks in the session file, so the same file in different sessions will not have the same bookmarks. SessionMgr v0.8 is my initial attempt at solving this problem.

    I realize that having session-unique bookmarks may be exactly what some people want, and so the global bookmarks feature can be disabled by opening "settings.ini" and setting "globalBookmarks=0" in the "[session]" section. The globalBookmarks setting is not yet available in the Settings dialog box. Don't edit the .ini file with NPP. Close NPP then use some other editor.

    This is a beta release for this new feature so save a copy of your session files and the existing SessionMgr.dll before trying this version. Version 0.8 will not be available from the NPP Plugin Manager. Get it here:

    Summary of changes in v0.8

    • Global bookmarks! Uses TinyXml2.
    • Saves the session when the bookmark margin is clicked.
    • Writes messages to a log file when in debug mode.
    • Uses Windows SDK v7.1, was v7.0a. Still uses MSVS2010 command-line tool chain.
    • Updated header files from NPP v6.6.9.

    Comments on this implementation

    The file "file-properties.xml", in the SessionMgr config directory, stores bookmarks, firstVisibleLine, language and encoding for each unique pathname in all your sessions. There are 3 cases where global persistence comes into play...

    (1) After a session is saved, the global bookmarks, firstVisibleLine, language and encoding are updated from the session properties.

    (2) When a session is about to be loaded, the session bookmarks, language and encoding are updated from the global properties, then the session is loaded.

    (3) When an existing document is added to a session, its bookmarks and firstVisibleLine are updated from the global properties, then the session is saved.

    The global properties file is initially empty. Your global bookmarks will get updated as you load different sessions. You can speed up this process by loading all your sessions, one by one, in order from earliest to latest last-modified time, or in order from least to most important.

    If you're interested, a log file is now written when in debug mode. Open "settings.ini" and set "debug=30" (20, 10 or 1 for less verbose) and "logFile=absolute-pathname-of-log-file" in the "[debug]" section. You can then watch events as they happen. Don't edit the .ini file with NPP. Close NPP then use some other editor.

  • Mike Foster

    Mike Foster - 2014-10-12

    Session Manager 0.8.1, now with MRU sorting!

    Version 0.8.1 will not be available from the NPP Plugin Manager. Get it here:

    Summary of changes in v0.8.1

    • Added an option to sort the sessions list by the session files' last-modified times in addition to alphabetically.
    • Improved the algorithm for resizing/repositioning controls when the dialog is resized by the user. Fixed a bug related to saving/restoring the dialog size.
    • Added a checkbox on the Settings dialog for the global bookmarks feature.
    • Some controls on the Sessions dialog now have keyboard shortcuts. Hold Alt then hit: l = Load, p = Previous, s = Save, i = Load into current, w = Load without closing, a = Sort by alpha, d = Sort by date.
    • Improved debug logging. Current and active buffer IDs are logged for notifications.
    • Changed the About text. Big updates to the help page.
  • Pavel Nedev

    Pavel Nedev - 2014-10-17

    Hi Mike,
    Thanks for this plugin, I'm extensively using it and it is of great help to me!
    I've noticed that if I have opened a session and then load another one the first one is automatically saved. I have disabled auto-save option and ideally I would expect that the session will only be saved when I manually do so.
    Do I have the wrong expectations or am I missing something?

  • Mike Foster

    Mike Foster - 2014-10-18

    Hi Pavel, I will look into that. Thanks!

  • Mike Foster

    Mike Foster - 2014-10-19

    Pavel, yes you're right, that was a bug. I've fixed it in v0.8.2. Thank you!

    Version 0.8.2 will not be available from the NPP Plugin Manager. Get it here:

    Summary of changes in v0.8.2

    • Fixed a bug reported by Pavel (thanks!): When about to load a new session, do not save the current session if 'Auto save' is disabled.
    • In the "Create New Session" dialog, renamed "From the currently open files" to "As a copy of the current session" and renamed "By copying the selected session" to "As a copy of the selected session".
    • Renamed some Config class methods.
    • Tweaked some button positions.
    • Made improvements to the help page.
  • Pavel Nedev

    Pavel Nedev - 2014-10-20

    That fixed the problem, thanks Mike!

  • Mike Foster

    Mike Foster - 2014-11-06

    Session Manager 1.0!

    Version 1.0 will be available from the NPP Plugin Manager. You can also get it here:

    Summary of changes in v1.0

    v1.0, 06Nov2014

    • After three years Session Manager is finally released as version 1.0!

    v0.8.4.1, 06Nov2014, binary not released

    • Unicode-related fixes and improvements:
      -- Modified TinyXml2's load/save to support unicode file names.
      -- Adds an XML declaration if it is missing from the global properties file. However, NPP saves session files without a declaration.
      -- Rewrote the 'pth' functions to be more unicode safe.
      -- The debug log file name and messages can now be unicode.
      -- No longer includes 'tchar.h' and no longer uses _T, TCHAR and related macros. Uses wide chars and wide stdlib and Win32 functions explicitly. Still defines UNICODE and _UNICODE.
      -- Session files are read/written as UTF-8. The 'settings.ini' file is still read/written as UTF-16LE – keep that in mind if you edit the file manually. I may eventually change that file to XML format and UTF-8 encoding.
      -- Writes pathnames in session files (using in the format NPP requires: all chars < 32 or > 126 are converted to entities.
    • Renamed 'file-properties.xml' to 'global.xml'. Sorry for the non-back-compat change. You can just rename the old file to the new name.
    • Improved error handling and messages, but it needs more testing.
    • Using dynamic allocation in many places instead of static buffers.
    • Using newer style for BrowseForFolder (should be supported by 98, ME and above).
    • On startup, cleans the global file properties file by removing File elements whose files do not exist on disk.
    • Implemented an API that can be called by NPP or other plugins. Documented in 'SessionMgrApi.h'.

    v0.8.3, 28Oct2014, binary not released

    • Bug fix: Now properly updates current and previous session names on delete or rename.
    • Now will not let you delete the current session.
    • Moved the global properties functions to their own file.
    • Made misc minor improvements to the code.
    • Experimenting with doxygen notation.
    • Made big improvements to the help page.
  • Bernd G

    Bernd G - 2014-11-12

    Great plugin, making npp-sessions useful for me.

    However, I noticed I cannot open files per context menu or file association when npp is not yet running. Probably still the same as in ?

    My question is, could you not simply leave the session-loading at startup to NPP?
    At least if "Remember current Session for next launch" is checked?

    If I see it right in that case NPP opens the session, plus the file it is asked to load. Then the plugin closes all files and opens the same session again. Doesn't really make sense.
    All it would need to do is internally set the last session as loaded. Mabye even save it because now there is a file more in it.

  • Mike Foster

    Mike Foster - 2014-11-12

    Hi Bernd, I'm glad you like the plugin! Sorry for the late reply - I seem to have to constantly resubscribe to get email updates from this forum.
    You have some good points there. I will investigate.

  • Mike Foster

    Mike Foster - 2014-11-15

    I just took the most straight-forward approach to solving it (described below). Thanks very much for reporting the problem!

    Version 1.0.1 will be available from the NPP Plugin Manager. You can also get it here:

    Summary of changes in v1.0.1

    v1.0.1, 15Nov2014

    • Fixed a regression bug reported by Bernd G (thanks!). Now, on startup, regardless of these options in the settings file, it considers "Load into current" to be false because there is no current session on startup, and it considers "Load without closing" to be true so it doesn't close files opened via the NPP command line.
    • Removed global properties support for the "encoding" attribute. It seems NPP doesn't use it, it's always -1.
    • Updated the help file.
    • Bernd G

      Bernd G - 2015-01-08

      Thanks for fixing that. However, I am still not completely happy. When I doubleclick a file I expect it to open - visibly. While it now is indeed loaded, its not automatically the active tab so I have to search for it and activate it myself.

      • Mike Foster

        Mike Foster - 2015-01-09

        You're right, that's a good point. I'll work on that. Thanks!

  • CarlitoGil

    CarlitoGil - 2014-11-27

    Hi, thanks for the plugin.

    I found a bug, I suppose.

    I have Multi-Instance enabled in the main settings.

    Let's say in the [DEFAULT] session there's a file named DEFAULT.txt.

    I use the plugin to load another session named [TEST], with one file named TEST.txt.
    Load into current = false
    Load without closing = true

    The new session with TEST.txt is named [DEFAULT] and the session with DEFAULT.txt is now named [TEST].

    Auto save = true
    So when this session named [TEST] is auto-saved, it will have DEFAULT.txt and overwrite the one with TEST.txt.

  • Mike Foster

    Mike Foster - 2014-11-27

    Hi Carlos, thanks for the bug report. I will try to investigate it over the weekend, but I have some initial questions.

    • What SessionMgr version are you using?
    • In your scenario, are multiple instances of NPP being used, or is the scenario just in one NPP instance?


  • Mike Foster

    Mike Foster - 2014-11-28

    The new session with TEST.txt is named [DEFAULT] and the session with DEFAULT.txt is now named [TEST].

    I don't understanding what's described in this step of your scenario. For me at that point the current session is TEST and both "DEFAULT.txt" and "TEST.txt" are open. On auto-save both of those files are recorded in the TEST session file. Perhaps I am misunderstanding the steps required to reproduce the bug.

  • Mike Foster

    Mike Foster - 2014-12-22

    Session Manager 1.1!

    Version 1.1 will be available from the NPP Plugin Manager. You can also get it here:
    And read the documentation here:

    Summary of changes in v1.1

    • New feature: Filters! Only sessions that contain the filter, and the current and previous sessions, are displayed in the sessions list.
    • New feature: Favorites! Sessions can be marked as favorites and up to 20 of them are displayed in the Notepad++ Plugins menu and optionally in the context (right-click) menu.
    • New feature: Marks to the left of the name in the sessions list indicate current, previous, default and favorite sessions.
    • New feature: Optional automatic creation and update of a Session Manager submenu in the context (right-click) menu.
    • The default session file is now stored in the sessions directory with the other session files and is displayed in the sessions list. It can now be renamed (but not deleted).
    • The SessionMgrApiData struct is now compatible with casting to NPP's CommunicationInfo struct.
    • Bug-fix: Renaming a session caused a problem when the new name was longer than old name.
    • Bug-fix: On margin click, the bookmark is not yet set in NPP. Saving the session then did not save the bookmark for that click, it only got saved the next time.
    • Bug-fix: Initial ini file content had wrong menu property names.
    • Made big improvements and updates to the help page.
  • Mike Foster

    Mike Foster - 2014-12-24

    Oops. I found a bug. Favorites are duplicated in the context menu. I already have a fix for it, but before releasing it I'm testing something else: I lost most of my global bookmarks. So far I cannot reproduce it so I'm starting to think it's not a bug in v1.1 but maybe happened for some other reason -- maybe one of the NPP crashes I've had recently.

    Update: I think the bookmarks problem was because of me changing git branches while I had that project open in NPP.

    Last edit: Mike Foster 2014-12-24
  • Mike Foster

    Mike Foster - 2014-12-24

    Session Manager 1.1.1

    Version 1.1.1 will be available from the NPP Plugin Manager. You can also get it here:
    And read the documentation here:

    Summary of changes in v1.1.1

    • Bug-fix: Favorite Item elements were being duplicated in the context menu.
  • Mike Foster

    Mike Foster - 2015-01-02

    Session Manager 1.2

    Version 1.2 will be available from the NPP Plugin Manager.
    You can also get it here:
    And read the documentation here:

    Summary of changes in v1.2

    • Settings are now read/written in XML format and as UTF-8. Your existing settings will be upgraded to the new format and the old "settings.ini" file will be deleted.
    • There are two new settings, cleanGlobalProperties and settingsSavePoll, but only in the file, not on the settings dialog.
    • Bug-fix (thanks Leandro!): When loading a file via the NPP command-line, the file was loaded but not the session, and the session was saved containing only that file opened via the command-line. I fixed that bug in v1.0.1 but evidently I caused a regression in v1.1.
    • Bug-fix: Only the last new filter was being saved, and then only if the dialog was closed while that filter was active.
    • Bug-fix: The Favorite button was not being repositioned when the dialog was resized.
    • Made improvements and updates to the help page.
    • Pavel Nedev

      Pavel Nedev - 2015-01-05

      Hi Mike,
      I upgraded to Session Manager 1.2 but in N++ plugin menu list and in Session Manager plugin menu itself all commands are named "notepad".
      Is it OK on your side?

  • Mike Foster

    Mike Foster - 2015-01-05

    Hi Pavel, thanks for trying v1.2, I'm very sorry it has caused problems for you. Thanks for taking the time to post a report here.

    1. Look in Session Manager's configuration directory. If "settings.ini" exists, or if you saved a copy of it, please post it here. Also, please post the new "settings.xml" here.
    2. Here's something to try:
    3. Stop Notepad++.
    4. Delete "settings.xml" and "settings.ini" (if it exists).
    5. Open "contextMenu.xml" with some other editor. It is in the same directory as the Notepad++ executable. Delete all lines that have FolderName="Session Manager" and save the file.
    6. Start Notepad++. Session Manager should create a default "settings.xml" file. You will need to open Session Manager's Settings dialog and configure the settings as you had them before.

    Again, I'm very sorry for the problems. Of course, you can just go back to the previous Session Manager version. Or, if you have time to try the above, I will be happy to help.

    I did a lot of testing of the code which upgrades from ini to xml but obviously I missed something. I will begin testing and debugging it again.

    Wishing a happy new year to you and yours,

    • Pavel Nedev

      Pavel Nedev - 2015-01-05

      Hi again Mike,
      Nothing to be sorry about, great work!
      Deleting the .ini and .xml files helped. Now everything is OK, thanks for the support!
      May I suggest making the sessions filter apply immediately as the user enters the filter string? Now it feels a bit strange - I'm writing the filter and I need to click somewhere in the available sessions window to actually see the filtering applied. It seems that the filter also is applied to the whole session name, that is, if I for example set 'n' as filter string all sessions that have 'n' in the name are shown not only those that start with the letter 'n'.
      Thanks again!
      Wishing you Happy New Year too!

      Last edit: Pavel Nedev 2015-01-05
  • Mike Foster

    Mike Foster - 2015-01-05

    That's good news! So the new xml format is working but the problem was in trying to automatically upgrade from ini to xml. Maybe I should just not do that. There are not many settings, maybe it's ok if the user has to customize their settings again after upgrading to v1.2 instead of the code trying to do it automatically.

    You have some good suggestions regarding the filters feature. I will be thinking about those and follow-up soon.

    Thanks for your quick reply!

  • Pavel Nedev

    Pavel Nedev - 2015-01-05

    That's great!
    I've noticed one more thing - that is nothing critical but anyway here it is:
    If you open plugin settings dialog and change nothing (but click OK) then Message Box appears saying nothing has changed but that box is actually hidden behind the settings dialog. Perhaps the settings dialog window is on-top-always?
    I clicked several times on settings dialog OK button and then cancelled to see that there where actually several message boxes below saying 'stop clicking you idiot' :)
    Perhaps you can simply close the settings dialog silently even if nothing has changed, it's up to you.

    Best Regards,

1 2 > >> (Page 1 of 2)

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

Sign up for the SourceForge newsletter:

No, thanks