FRename3

Here you can discuss about your favorite plug-in.
User avatar
HaRT
Moderator
Posts: 10806
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 220 times
Been thanked: 357 times

FRename3

Post by HaRT »

Latest post of the previous page:

pepak wrote: Mon 12 Oct, 2020 16:05 a solution that would work regardless of the respective lengths of the filenames
I'd suggest scrolling no more than is required to move the leftmost longest possible part of the new name into view (in my particular example, no scrolling would happen).
pepak wrote: Mon 12 Oct, 2020 16:05 why do you need to see the original filename?
It's more of a comfort: when the text stays in (or close to) its original position in the window and the caret jumps, I easily understand what happened; when the text seemingly changes (with no clear indication of horizontal scrolling), I'm very confused, and it takes effort to accommodate to the new “landscape”.
pepak wrote: Mon 12 Oct, 2020 16:05 Until you change it, it's the same as the new filename which you CAN see...
Not quite so: it's the same until I change it for the first time only, while I might change my mind several times in a single renaming session.
pepak wrote: Mon 12 Oct, 2020 16:05 I suppose there could be an option for ALT+F1 behavior. Added it to the TODO list.
I suggest the choice is at least three-way Scrolling:  ( ) Minimal  ( ) Smart  ( ) Maximal where Minimal is what happens when the caret merely jumps to the required position (and stays visible), Smart means minimal scrolling to move the leftmost longest possible part of the new name into view (as suggested above), and Maximal means to scroll the new file name to the window's leftmost column (as is implemented now).
User avatar
HaRT
Moderator
Posts: 10806
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 220 times
Been thanked: 357 times

FRename3

Post by HaRT »

pepak wrote: Mon 12 Oct, 2020 16:05 Maybe I don't understand what you mean here.
Here are the steps to reproduce what I describe:
1. Run far.exe -p"%FARHOME%\Plugins\FRename3" -s %TEMP%\FarProfile\%RANDOM% in a separate window.
2. In there, run mode con cols=50 lines=17 (just for illustration purposes).
3. Position e.g. to Far.exe.example.ini, invoke FRename3 — the window looks (with a hand-drawn right border; excuse excessive HTML div width).
4. Cancel renaming, open FRename3 configuration dialog, set [x] Show short help message, accept.
5. Invoke FRename3 again — the window looks now (with a hand-drawn right border again) whereas I was expecting it to look because the option I changed is unrelated to the initial positioning.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

FRename3

Post by pepak »

Sounds reasonable. Thanks.
BestiaPl
Posts: 5
Joined: Tue 12 May, 2020 11:19
Been thanked: 1 time

FRename3

Post by BestiaPl »

Polish translation - FRename3 2.01
Attachments
frename3-pl.zip
FRename3 PL (2.01)
(4.72 KiB) Downloaded 94 times
User avatar
HaRT
Moderator
Posts: 10806
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 220 times
Been thanked: 357 times

FRename3

Post by HaRT »

Feature request: please support updating file descriptions (I'm open for discussion about details). Currently, the benefits of the plug-in vanish when one has to update descriptions of the renamed files manually making essentially the same text changes again.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

FRename3

Post by pepak »

I don't use file descriptions myself. What exactly do you mean by updating them?
User avatar
HaRT
Moderator
Posts: 10806
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 220 times
Been thanked: 357 times

FRename3

Post by HaRT »

pepak wrote: Thu 22 Oct, 2020 05:24 I don't use file descriptions myself. What exactly do you mean by updating them?
Oops, I see the wording I used is vague.
What I mean is that currently once files are renamed using the plug-in, they lose their descriptions, because those are still associated with the old names in the descriptions file.
To see this, do the following: use panel mode with the Descriptions column (by default, mode 6 or 7), assign a description to a file (using CtrlZ), see the description displayed in the column, rename the file using the plug-in — the displayed description is gone (it's still present in the descriptions file but associated to the old name).
So I suggest that the plug-in updates affected file names in the descriptions file to fix the associations. Of course, when doing so it should honor what is specified in Options | File descriptions.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

FRename3

Post by pepak »

That might actually be quite a problem.

First of all, I don't think there is an API for reading FAR's options. I remember searching for it some time ago when writing the DirSync3 plugin, but I couldn't find it. So it might not be possible to "honor what is specified in Options -> File descriptions" because I might not be able to read its value.

What's worse, there doesn't seem to be an API for manipulating descriptions. I can read the descriptions using PanelControl, but my quick search through the Encyclopedia failed to reveal any function for actually setting descriptions. That would basically mean that I would have to edit the description file directly, which most definitely is not a wise thing to do - it's prone to create incompatibility issues down the way.
User avatar
buniak_a_h
Posts: 4234
Joined: Sat 20 Apr, 2013 00:17
Location: Санкт-Петробад
Has thanked: 222 times
Been thanked: 642 times
Contact:

FRename3

Post by buniak_a_h »

pepak wrote: Fri 23 Oct, 2020 06:00 First of all, I don't think there is an API for reading FAR's options. I remember searching for it some time ago when writing the DirSync3 plugin, but I couldn't find it. So it might not be possible to "honor what is specified in Options -> File descriptions" because I might not be able to read its value.
Far.GetConfig('Descriptions.ListNames')
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

FRename3

Post by pepak »

buniak_a_h wrote: Fri 23 Oct, 2020 06:04Far.GetConfig('Descriptions.ListNames')
Where did you find it? There is no reference to GetConfig in any of the API headers or the FarEncyclopedia. It might be available in the macro API, but that's useless for me as I am writing native plugins, not LUA ones.
User avatar
John Doe
Бюрократ
Posts: 13801
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 72 times
Been thanked: 425 times
Contact:

FRename3

Post by John Doe »

buniak_a_h, wrong advice. GetConfig belongs to macro api.

pepak, there is SettingsControl (docs are brief and incomplete. Something is in changelog).
https://t.me/FarManager — Telegram чат
User avatar
HaRT
Moderator
Posts: 10806
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 220 times
Been thanked: 357 times

FRename3

Post by HaRT »

pepak wrote: Fri 23 Oct, 2020 06:00 I don't think there is an API for reading FAR's options.
AFAICS, SettingsControl provides that when passed FarGuid.
pepak wrote: Fri 23 Oct, 2020 06:00 That would basically mean that I would have to edit the description file directly
Alternatively, the plug-in might open the descriptions file (if any) in a follow-up editor, perform renamings there, group affected lines at the beginning, and let the user review and save. Doing so will both avoid issues with encoding/newlines and serve as a confirmation/reminder.
Фар есть инструмент, а не нянька. © 2009 DrKnS
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

FRename3

Post by pepak »

I wouldn't hold my breath if I were you, but I will look into it.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

FRename3

Post by pepak »

I was looking at the Descriptions support. It seems that despite my misgivings, it might be best to edit the description file directly. However, since I am not familiar with the descriptions functionality, I have a few questions:
  1. Is it possible to create multiline descriptions?
  2. Is it possible to create descriptions for files in subdirectories (e.g. using backslash for separator)?
  3. How does it work if Descriptions.ListNames contain multiple files and the same filename appears in two description files but with a different description in each?
  4. Does the item order make any difference? For example, should I keep the filenames sorted?
  5. Which encoding and line ending should I use? It seems to me FAR uses ANSI+CRLF, but is that a fixed thing or can it vary?
Last edited by pepak on Sun 25 Oct, 2020 11:47, edited 1 time in total.
User avatar
HaRT
Moderator
Posts: 10806
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 220 times
Been thanked: 357 times

FRename3

Post by HaRT »

pepak wrote: Sun 25 Oct, 2020 11:44 1. Is it possible to create multiline descriptions?
Technically, yes, you can create a multiline description even in FAR itself (CtrlZ l i n e 1 CtrlQ CtrlM Space l i n e 2 Enter) but FAR will use only the first line for whatever operations. Some good old plug-ins (like DescEdit or AltDescr) and tools (like PDE) used to support multiline descriptions but the plug-ins were not ported to FAR 3, and I doubt PDE supports Unicode file names.
pepak wrote: Sun 25 Oct, 2020 11:44 2. Is it possible to create descriptions for files in subdirectories (e.g. using backslash for separator)?
I never heard of such scenario, and the standard TmpPanel plugin doesn't seem to support descriptions at all.
pepak wrote: Sun 25 Oct, 2020 11:44 3. How does it work if Descriptions.ListNames contain multiple files and the same filename appears in two description files but with a different description in each?
My experiments show that FAR finds the first existing descriptions file from the list in the current directory and ignores others, so e.g. if you specify description of file 1 in, say, Descript.ion and description of file 2 in, say, Files.bbs, you'll see only one of these descriptions at a time depending on which descriptions file is listed first in preferences.
pepak wrote: Sun 25 Oct, 2020 11:44 4. Does the item order make any difference? For example, should I keep the filenames sorted?
No, the order does not make any difference for FAR, but it may make some difference for some people — e.g. when I download a bunch of related files and assign descriptions right away, I'll be more comfortable seeing them grouped when viewing or editing the descriptions file manually. So, ideally, when your plug-in renames files and updates their names in the descriptions file, I'd prefer it to avoid reordering lines.
pepak wrote: Sun 25 Oct, 2020 11:44 5. Which encoding and line ending should I use? It seems to me FAR uses ANSI+CRLF, but is that a fixed thing or can it vary
As for EOLs, FAR overwrites with CRLF upon each update but reads LF and CR just fine. Encoding is determined by the settings: [ ] Use ANSI code page by default and [ ] Save in UTF-8. Unless UTF-8 is chosen, either ANSI or OEM is used. So you plug-in should either mirror this logic or use UTF-8 because Unicode file names will lose their descriptions otherwise.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

FRename3

Post by pepak »

Thanks. That seems promising, although the last point may give me trouble (particularly the distinguish between ANSI and OEM) - it might be necessary to only support UTF8 or ANSI description files.
Post Reply

Return to “General Plug-In Discussions”