Filters

Here you can discuss about your favorite plug-in.
pepak
Posts: 433
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 6 times
Been thanked: 24 times

Filters

Post by pepak » Tue 27 Mar, 2018 17:30

Latest post of the previous page:

So far:
  • Added the history support.
  • Fixed incorrect end-of-line on the last line.
  • FIxed the EConvertError.
Other comments:
  • I think I have a clear idea of how to implement the parameters-just-before-execution.
  • FAR-like metacharacters won't be supported. Way too much work for too little gain. Percentages will stay.
  • Undo seems to be a bug in FAR rather than in the plugin. Even if I move the creation of undo block before any other operation, the cursor still doesn't return to the original place.
  • Found an error with executing the plugin when the curor is outside of the selected block. Will fix.

pepak
Posts: 433
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 6 times
Been thanked: 24 times

Filters

Post by pepak » Tue 27 Mar, 2018 17:32

HaRT wrote:
Tue 27 Mar, 2018 14:41
I did not mean metacharacters in general. I rather suggested the particular parameters input syntax I mentioned: !?$<history>$<title>?<init>!. Is it familiar to you?
Yes, but I won't be implementing that.
What do unescaped percent signs mean? A hint would be useful somewhere in the dialog (or at least in the docs).
readme.en.txt, line 112-124.
But please note that the dialogs are totally unusable after the error now. Or is it what you mean by “untranslated”?
Change the string "Unknown '%%%c' at position %d - configuration is invalid" in the language file to "Unknown '%%%s' at position %d - configuration is invalid" and the error is gone.

User avatar
HaRT
Moderator
Posts: 9088
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 90 times
Been thanked: 157 times

Filters

Post by HaRT » Tue 27 Mar, 2018 18:19

pepak wrote:
Tue 27 Mar, 2018 17:32
readme.en.txt, line 112-124.
Indeed! I managed to forget this between reading the docs when I first saw the plugin and creating my first external filter yesterday. I changed the label this way: "&Command template (%i Input, %o Output, %w Width, %% percent)" for it to be my hint.
pepak wrote:
Tue 27 Mar, 2018 17:32
Change the string […] and the error is gone.
Thanks.
Фар есть инструмент, а не нянька. © 2009 DrKnS

pepak
Posts: 433
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 6 times
Been thanked: 24 times

Filters

Post by pepak » Fri 30 Mar, 2018 11:04

Released version 0.03
  • Added support for plugin-call to a named filter. This allows calling of external filters which weren't available to plugin-calls in previous versions. Use the Filters.ExecuteByName script function; as an argument, provide the description of your filter, as entered into the filter's configuration.
  • Added support for a filter reconfiguration just before use. The purpose of this feature is to allow a modification of arguments of an external filter as per immediate requirements without having to create multiple filter configurations in advance. Just mark the filter as "Edit before use" and you will be asked to modify the filter settings before use.
  • Added support for combined STDOUT and STDERR output to the external filters.
  • Added history support to edit fields in the dialogs.
  • Fixed: After editing a filter's configuration, the selection of the filter list moved to the first item. Now it will stay at the edited item.
  • Fixed: If the filter was run against a selection and the filtered output ended with a newline, that newline got discarded and the first line after the selection got appended to the last line of the output.
  • Fixed: With persistent blocks enabled, if the cursor was outside of the selection at the time the plugin was executed, the filtered output would get written at the cursor position (i.e. inside some completely unrelated section of the file).
  • Moved the definition of the start of the undo block before any other operation on the editor's content in the hope that it would include the cursor movement into an Undo, if the user decided to use it. Unfortunately, it seems that FAR does not consider cursor movements a part of the Undo block (FAR3 build 5134).
  • Fixed an EConvertError exception when entering incorrect % modifiers into the external filter's command template.
Source codes can't be uploaded to PlugRing due to 413 Request Entity Too Large.

User avatar
HaRT
Moderator
Posts: 9088
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 90 times
Been thanked: 157 times

Filters

Post by HaRT » Fri 30 Mar, 2018 14:31

pepak wrote:
Fri 30 Mar, 2018 11:04
Released version 0.03
Thanks a lot!

A minor glitch: if I change a filter in another (second) instance of Far, I then see the changes in the plugin's configuration in the first instance, but if I open an editor there (in the first instance), the old configuration is still in effect.

And a minor wish: if the external filter cannot be executed (e.g. inaccessible executable), please restore/ don't clear the selection.
Фар есть инструмент, а не нянька. © 2009 DrKnS

pepak
Posts: 433
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 6 times
Been thanked: 24 times

Filters

Post by pepak » Fri 30 Mar, 2018 14:42

HaRT wrote:
Fri 30 Mar, 2018 14:31
A minor glitch: if I change a filter in another (second) instance of Far, I then see the changes in the plugin's configuration in the first instance, but if I open an editor there (in the first instance), the old configuration is still in effect.
That's more or less by design. It could be changed with a minor effort, but I rather liked the effect of having an "active" set of filters and a set of "stored" filters. Plus it somewhat speeds up the plugin execution (I guess by as much as a few microseconds :-)). But I will think about it.
And a minor wish: if the external filter cannot be executed (e.g. inaccessible executable), please restore/ don't clear the selection.
That might be a lot more difficult than it looks, actually. I will see.

pepak
Posts: 433
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 6 times
Been thanked: 24 times

Filters

Post by pepak » Sat 14 Apr, 2018 06:26

HaRT wrote:
Fri 30 Mar, 2018 14:31
A minor glitch: if I change a filter in another (second) instance of Far, I then see the changes in the plugin's configuration in the first instance, but if I open an editor there (in the first instance), the old configuration is still in effect.
Fixed in 0.04 (not yet released).
And a minor wish: if the external filter cannot be executed (e.g. inaccessible executable), please restore/ don't clear the selection.
As far as I can tell, that is done by FAR, not me. At least, I couldn't find any place in my code where I could terminate the plugin and still keep the selection alive.

pepak
Posts: 433
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 6 times
Been thanked: 24 times

Filters

Post by pepak » Sun 15 Apr, 2018 07:28

Released version 0.04
  • In the filter configuration dialog, you can press the Copy button or keys F5 or CTRL+C to make a copy of the selected filter.
  • If a filter is set to "edit before use", its configuration dialog contains a new checkbox to let you save the modified settings to the configuration to make them permanent.
  • Filter list is always loaded just before use. As a result, if multiple instances of FAR are running and you change the plugin's configuration in one of them, it will immediately apply to all of them.
  • If a filter set to "edit before use" was called from a script, it would execute immediately without displaying the configuration dialog.

skipik
Posts: 151
Joined: Wed 03 Jun, 2015 15:24
Has thanked: 18 times
Been thanked: 15 times

Filters

Post by skipik » Mon 16 Sep, 2019 23:35

I get this on an HTML file:

How to fix that?
Plugin version is 0.4.0.498.

User avatar
HaRT
Moderator
Posts: 9088
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 90 times
Been thanked: 157 times

Filters

Post by HaRT » Mon 16 Sep, 2019 23:58

skipik, Do you have elinks.exe in any of your PATHs? Can you execute the command line from the error text normally (with some existing HTML file of course)?
Фар есть инструмент, а не нянька. © 2009 DrKnS

skipik
Posts: 151
Joined: Wed 03 Jun, 2015 15:24
Has thanked: 18 times
Been thanked: 15 times

Filters

Post by skipik » Tue 17 Sep, 2019 09:38

HaRT wrote:
Mon 16 Sep, 2019 23:58
Do you have elinks.exe in any of your PATHs?
Ah, I don't. Where I should get it? Is there any link for binaries? Or I should build it by myself?

// upd

Nvm, found it.
Last edited by skipik on Tue 17 Sep, 2019 11:16, edited 1 time in total.

2useven10
Posts: 3965
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 4 times
Been thanked: 168 times

Filters

Post by 2useven10 » Tue 17 Sep, 2019 10:58

skipik wrote:
Tue 17 Sep, 2019 09:38
Where I should get it?
google knows where.

User avatar
HaRT
Moderator
Posts: 9088
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 90 times
Been thanked: 157 times

Filters

Post by HaRT » Thu 26 Sep, 2019 11:19

pepak wrote:
Sun 15 Apr, 2018 07:28
Released version 0.04
In the “Plugin Information” dialog (F3 in the “Plugin commands” menu), the Version is 4.0.0.497. Shouldn't it be 0.4.0.497 instead.
Фар есть инструмент, а не нянька. © 2009 DrKnS

pepak
Posts: 433
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 6 times
Been thanked: 24 times

Filters

Post by pepak » Thu 26 Sep, 2019 18:55

It depends. What is the source of Plugin Information's dialog data? Because if you look at the version properties of the DLL using standard Windows APIs (e.g. using Explorer), you will get version 0.4. It is possible that P.I. does not use Windows standard VERSION_INFO, but in that case I am inclined to consider it an error in FAR, not the plugin.

User avatar
HaRT
Moderator
Posts: 9088
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 90 times
Been thanked: 157 times

Filters

Post by HaRT » Thu 26 Sep, 2019 21:20

pepak wrote:
Thu 26 Sep, 2019 18:55
What is the source of Plugin Information's dialog data?
Presumably the Version field of the GlobalInfo structure filled in the GetGlobalInfoW function exposed by the plug-in. Formally, it's unrelated to Windows' VERSION_INFO, but ideally should represent the same version. Far Encyclopedia recommends using the MAKEFARVERSION macro to form the version value.
Фар есть инструмент, а не нянька. © 2009 DrKnS

pepak
Posts: 433
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 6 times
Been thanked: 24 times

Filters

Post by pepak » Fri 27 Sep, 2019 19:19

Yep, it's an error in all my plugins. Will fix it eventually to match the Windows version info.

User avatar
HaRT
Moderator
Posts: 9088
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 90 times
Been thanked: 157 times

Filters

Post by HaRT » Mon 07 Oct, 2019 14:57

pepak, a bug surfaced: the “JSON format” filter does not show up in *.json files where the top-level element is not an object, mostly affecting JSON files with a top-level array. According to the grammar, object is not the only valid top-level element, and top-level arrays are of particular importance.
How to reproduce: create a file named e.g. json.json with 2 characters: [], invoke Filters.
Фар есть инструмент, а не нянька. © 2009 DrKnS

Post Reply

Return to “General Plug-In Discussions”