vonshednob / pter

Manage your todo.txt in a commandline user interface (TUI)
https://vonshednob.cc/pter/
MIT License
102 stars 6 forks source link

Request: Add filename in task format? #61

Closed ironhak closed 5 months ago

ironhak commented 5 months ago

In task format it would be nice to have file name, like: task: {filename} {description}. Useful if you have different todo.txt for different projects.

andrei-a-papou commented 5 months ago

I second that! For consistency I would suggest {file} as pter can already search by file: in the search bar.

vonshednob commented 5 months ago

Ah, I see! Yeah, sounds like a good idea.

How do you envision the differentiation between files that have the same name but live in different folders? I have a separate todo file for multiple projects, but they are all called todo.txt. The filename alone wouldn't cut it :thinking: not sure how to solve this in a meaningful way.

andrei-a-papou commented 5 months ago

Good point. Maybe we could grab the second-to-last path segment and include that?

_~/Documents/TODOs/foldera/todo.txt and _~/Documents/TODOs/folderb/todo.txt would then show as _foldera/todo.txt and _folderb/todo.txt.

All the way to showing the full path if necessary (an extreme case, of course).

vonshednob commented 5 months ago

Hm, this could lead to super awkwardly long fields. But then, that's what you get :sweat_smile: It would work though!

andrei-a-papou commented 5 months ago

Yes, it would serve as a painful reminder for not having identical files buried super-deep in nearly identical folder structures :) On a serious note, a super-long path could be ellipsized, let's say, in the middle to alleviate the problem.

Persoanlly I wouldn't bother for now. I remember somebody on codeberg reported a bug with super-long lines. Perhaps in the future when that bug is addressed it would also solve the hypothetical super-long filenames problem. It's your call.

ironhak commented 5 months ago

Ah, I see! Yeah, sounds like a good idea.

How do you envision the differentiation between files that have the same name but live in different folders? I have a separate todo file for multiple projects, but they are all called todo.txt. The filename alone wouldn't cut it 🤔 not sure how to solve this in a meaningful way.

You right but generally speaking you should have different names for different projects. And if someone wants two identical files called todo.txt, so be it, I would avoid adding more conditions like: "if file A has same name of file B then show full path instead of file name". I would just leave the file name, and then you're free to modify the name or not.

andrei-a-papou commented 5 months ago

You right but generally speaking you should have different names for different projects.

It's not always possible though. I use an Android app whose todo.txt is synced with my desktop (where I use pter.) I haven't found a way to change the todo file in that app, it just uses todo.txt and done.txt, that's it :)

But I do agree it shouldn't be a biggie. For me, implementing even basic support for this feature would outweigh corner cases.

@vonshednob By the way, when creating a task with multiple todo files open, would pter somehow differentiate between identically named files when you press <f6>?

vonshednob commented 5 months ago

Oh that's a good one! I have no idea how that was solved, if at all. It's been more than two weeks, so waaay past the event horizon. I'll have a look.

vonshednob commented 5 months ago

I don't think the selection dialog does anything special. It just uses displayname of Source, which is simply the filename without the path. I have the feeling that I detached the filename from the displayname of the task source to later be able to allow the display of unique labels per file.

vonshednob commented 5 months ago

Fixed as of commit 7bc9b1ae, so this feature will be in the next release.

ironhak commented 5 months ago

Amazing!!!! :D

andrei-a-papou commented 5 months ago

Works great, thank you! Quick question: can pter highlight arbitrary "fields" like file:todo.txt in the task list?

[Highlight]
;; gray
file = 12
sel-file = 8

It works for due and t, but doesn't seem to work for file:. Highlighting file: would need a patch, correct?

andrei-a-papou commented 5 months ago

OK, right, I've looked at the code, those hl: highlights (due:, t:, etc.) are part of the description, so {file} needs extra love.

Added a patch here: https://github.com/vonshednob/pter/issues/62#issuecomment-1987380240