-
Notifications
You must be signed in to change notification settings - Fork 190
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
Enhancement: Special Symbol for File Description #65
Comments
misc/fexcept is definitely not the right place for that. May I ask how do you plan to use it? |
I would like to use it in a variety of cases, let me list just a few to give you an idea:
Of course, these are all individual cases and all of them can be solved on a case by case basis with Lua macros or by means of other workarounds. Trust me, I have done so. However, the same type of issue just keeps coming up, having the placeholder for descriptions would be a universal solution to all of them and, I believe, to many others that have not come up yet. Granted, though, I will absolutely survive without this feature. If you think it's a bad idea, just ignore it. |
I'm not saying it's a bad idea. Perhaps a little controversial - every other special symbol there is for some part of file name, while description is more like 'metadata'. However, it looks useful in your examples. |
The following code would implement this (as long as a reasonable token if (const auto Tail = tokens::skip(CurStr, tokens::description))
{
FarGetPluginPanelItem CurrentItem = { sizeof(FarGetPluginPanelItem) };
const auto Panel = ( SubstData.PassivePanel ? SubstData.Another.Panel : SubstData.This.Panel );
const auto ItemSize = Panel->SetPluginCommand(FCTL_GETSELECTEDPANELITEM, 0, NULL);
CurrentItem.Item = static_cast<struct PluginPanelItem*>(malloc(ItemSize));
if (CurrentItem.Item) {
CurrentItem.Size = ItemSize;
if (Panel->SetPluginCommand(FCTL_GETSELECTEDPANELITEM, 0, static_cast<void*>(&CurrentItem))
&& CurrentItem.Item->Description)
{
Out += CurrentItem.Item->Description;
}
free(CurrentItem.Item);
}
return Tail;
} This works because Ctrl+G is always operating on the first item which is currently selected, and if no item is selected, However, the rest of the code is designed to pass all relevant substitution information (file names) to Comments, thoughts? Would you accept this PR? I am gladly willing to invest more time into this if you would wish for a different solution. |
Far's internals shouldn't query the Plugin API at all. FCTL_GETSELECTEDPANELITEM is designed for plugins, allocating and throwing away a PluginPanelItem only to access Description is overkill. |
I would often like to have a special symbol for the description of a file, like
!.!
gives the long file name with extension, it might be possible to have!*
translate to the description of the current file. It can be just the empty string when there is none.The following was the only position in the code which looks like it is performing these substitutions:
FarManager/misc/fexcept/execdump/xxlib/Std/io_scr.cpp
Line 31 in 806c80d
However, I did not find any reference to the
MakePatternStr
function elsewhere, so I am not sure. Either way, it seems like the request can be easily implemented and if someone points me to the exact spot where the substitution is done, I'll gladly prepare a PR for this - but of course only if this change is welcome.The text was updated successfully, but these errors were encountered: