-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request] Created date for a tab #15563
Comments
Agree, forget about status-bar -- yuck. While I think @xomx 's proposal is a nice idea, it involves code changes. I believe @washaqq should be directed to try the Take Notes plugin. It provides an ability to create new tabs with the timestamp as the name of the tab and, importantly, also saves to disk in a true file independent of Notepad++'s control. Also, 8.6.9 implements NPPM_SETUNTITLEDNAME which allows an unsaved-to-disk file to be renamed via a plugin, so a script could be written to rename an untitled tab to something like Finally, and most simply, users could simply use the Edit > Insert > ... commands to insert a date right into the text of their file (e.g. at the very top), as a reminder of how "old" a tab might be. |
Such a PythonScript: # -*- coding: utf-8 -*-
from __future__ import print_function
# references:
# https://github.com/notepad-plus-plus/notepad-plus-plus/issues/15563 <-- this script may be found here
# for newbie info on PythonScripts, see https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript
from Npp import *
import time
from ctypes import (WinDLL, WINFUNCTYPE, addressof, create_unicode_buffer)
from ctypes.wintypes import (HWND, INT, UINT, WPARAM, LPARAM)
#-------------------------------------------------------------------------------
user32 = WinDLL('user32')
try:
notepad.hwnd # works in PS3
except AttributeError:
notepad.hwnd = user32.FindWindowW(u'Notepad++', None) # needed for PS2
LRESULT = LPARAM
SendMessageW = user32.SendMessageW
SendMessageW.restype = LRESULT
SendMessageW.argtypes = [ HWND, UINT, WPARAM, LPARAM ]
WM_USER = 0x400
NPPMSG = (WM_USER + 1000)
NPPM_SETUNTITLEDNAME = (NPPMSG + 115) # https://npp-user-manual.org/docs/plugin-communication/#2139nppm_setuntitledname
def rename_active_softnamed_tab(new_name):
b = create_unicode_buffer(new_name)
lp_newname = addressof(b)
rv = SendMessageW(notepad.hwnd, NPPM_SETUNTITLEDNAME, notepad.getCurrentBufferID(), lp_newname)
return rv
#-------------------------------------------------------------------------------
class NTWDAIN(object):
def __init__(self):
notepad.new()
t = time.strftime("%y%m%d-%H%M%S", time.localtime())
rename_active_softnamed_tab(t)
#-------------------------------------------------------------------------------
if __name__ == '__main__': NTWDAIN() Running the script creates a new tab (thus running the script would be used instead of File > New): |
I don't insist on the status bar, I just want to see it without clicking some buttons and accessing some menus, I don't use plugins too much and I'm not a fan of scripting because plugins and scripts are easily brake when new update comes, I like things naturally. If possible, please code it in source. |
Well, the N++ author usually doesn't entertain adding functionality into the core that is achievable via plugins...
Untrue. Summary: I've given several choices that allow you to have the functionality today, whether or not you choose to try any of those and see if they are workable is up to you. While your suggestion isn't bad, I think, if the time-created data were to be added to the UI, it should be added under View > Summary data. Users can't object too much if they have to assign a shortcut to that command and press one keycombo when they desire to see this not-so-often needed piece of information. It keeps the info in one place, not divided among two places. |
It is not about time-created, it is about when the N++ tabs were opened (both with the unsaved newxxx and with the regular files). I see this potential new feature as a N++ tab property rather than an open file/doc property. That is why I preferred to use a tab-tooltip (the right-click tab pop-up menu is also acceptable place for me) rather than a doc status-bar or e.g. your suggested doc summary. For me personally, this could be useful while managing old many-file sessions... |
That IS a time created; the time the tab was created so that a file could be opened into it. If there is other metadata that would be tab-related only (can't think of any), then it might be appropriate in a bigger tooltip.
|
Ok, this time no objections to this rephrasing from my side.
For now I do not know such either, but I can think of the possibility of using this as another hint for the inexperienced users (you know - those who grew up only on mobile phones and carelessly store their valuable data only in the "newxxx" tabs for months...). Just for a further highlighting of the difference between an opened regular file and an unsaved tab, mock-up No. 2:
But this will not fulfill the OP's request (and my laziness, I admit), hovering over the tabs (even the inactive ones) is simply faster:
|
Well, it depends, my experience tells me so |
Hi @xomx, Any progress? what are you going to do about this, is it on your agenda? Thanks. |
@washaqq But 1st step 1st - before anyone goes any further, the project maintainer should have given green light to such an idea, otherwise it is a waste of time. @donho Here is another possible mock-up: From the coding POV it should not be more than adding another Rationale summary:
|
Thanks for the feedback, then i will wait (maybe forever 😊). |
Just wanted to say I need this too)) Glad someone is working on it! |
Before saying "Hmm... it could be a useful.", the essential question is: Once we have the definitions, we can talk about this feature furthermore. |
It should reflect "the date the session file tab in N++ was first created". I see a problem with both the "opened" and "created" because the tab with the same session file can be recreated/reopened multiple times when the N++ is exited and then launched again (with the same session). So the simple "opened" or "created" does not accurately describe the matter and it would like be something better (but also short). So maybe "TAB first created: " ? |
Well actually both can work, created date for unsaved tab, opened date for saved and opened, so created date will be turn into opened when saved file opened otherwise it is created date for unsaved tab. I hope it is not tangled. |
Thank you for your definition. It helps me to see the need. What I see this feature should be (a tiny specs):
Does it sound reasonable the above description to you guys? |
Pros:
Cons:
Anyway, if you implement it as you suggested, please include also that hhmmss part info from the backup name (i.e. 2024-09-05 16:12:10 for the new 1@2024-09-05_161210). |
Sorry, I don't follow you at all. Could you elaborate it?
In the case that "Enable session snapshot and periodic backup" is not turn on, there are 2 ways to define the behaviour:
I personally prefer the 1st one, as it is simpler.
Why not? But only date - no time to be included in my mini specs above. |
I agree with @xomx on 3rd item. people may not enable backup setting, i even didn't know that it exists, so i just checked if it is enabled. can you mention someone who may implement it. |
It comes handy to me to quickly see when I first opened any tab in the session (be it newXXX unsaved, or some existing file), like: |
@xomx The "Created date" for the untitled document is the creation date of tab obviously. However, what will be the "Created date" for the existent on disk files? The creating time of file on the disk or the time when user open it in Notepad++? |
Yes.
"or the time when user
IMO - having this new feature for the newXXX tabs is more important. But if it will be there, I can imagine that having the same info for an opened file-tab will help me to maintain my N++ sessions. It is just another useful information, but it is not essential, of course. E.g. I have one multi-file log session open, and if I see the mentioned tab-info, I will know from what moment I have started watching for a particular log. |
I use notepad++ as a sort of quick notes app. I've got hundreds of tabs open. When I finally start to sort them out I really want to know when the tab was first created. If there could be info on when the file created with notepad++ was first started as a tab that would help me personally too, as that would let me deal with saved and not saves tabs same way and not require me to have that initial creation date in filename. |
@ivangretsky @washaqq |
As for me I am ok with dates only for the not-yet-saved tabs. I can understand that saving tab creation date somewhere is not an obvious task. Wanted this just in case. |
@ivangretsky @xomx OTOH, it's OK to me to display the created date only for "new tab #" without any new added option. |
Ok, your reasoning makes sense, I like the KISS too. Moreover, now that I have thought about it more, displaying that metadata info also for the tabs with regular files might confuse some users rather than help them. I have only one note - rather than making the tab-timestamp info dependent on the (optionally enabled) backup snapshots files, I would do it the other way around - making the N++ backup file-naming dependent on the N++ tab-timestamps. So then the tab-timestamp info will be passed/stored by naming the possible N++ backup-snapshot files (and not via storing another item in the session.xml file as I suggested before or by checking the file-times as you suggested).
Doing so would allow the same info for users not using the N++ backup snapshot feature. That way we can also avoid unnecessary file IO usage because otherwise the GetFileAttributes for the relevant tab backup-file will be called every time the mouse hovers over a newXXX tab. It then also covers corner cases like when a user switches temporarily N++ snapshots OFF (ON/OFF/ON), so the backup snapshot file will have a new filetime etc... |
@xomx |
Tried with the latest commit and the only problem detected is no tab-creation date tooltip for the 1st newXXX empty tab, the others are ok:
No, it is not undesired, at least not for me:
|
@xomx
Fixed in the latest status of PR.
Nice to see that you're happy with this "feature". :) A side note: the tip is on 2 lines without "Created date: " (in the latest commit), because it's obvious to me that users will realize what it is. Therefore we save the room & translation. |
That was my last objection, I did not even have time to mention that little not-so-clear imperfection here :-)
👍 perfect KISS in action, as always Thanks for your time & implementation. |
Is there an existing issue for this?
Description of the Issue
Need created date for tabs
Describe the solution you'd like.
Sometimes i leave tabs open for a long time, and i forget the date i open that tab, it would be beneficial if there is tab created date somewhere in footer..
Debug Information
Anything else?
No response
The text was updated successfully, but these errors were encountered: