Filters

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

Filters

Post by pepak » Sat 10 Mar, 2018 09:53

This topic discusses the Filters plugin.

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

Filters

Post by HaRT » Sat 10 Mar, 2018 20:37

Does the plugin support being applied to the selection only?
Will it replace the block (“vertical”) selection correctly?
When fed the selection, can it replace the entire editor contents?
Will it preserve/unify EOLs? Can this be toggled?
Can it handle stderr instead of/ together with stdout?

In genera, it would be useful to have an outline of current and planned features (and of known bugs) in the announcement.
Фар есть инструмент, а не нянька. © 2009 DrKnS

pepak
Posts: 369
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 5 times
Been thanked: 11 times

Filters

Post by pepak » Sat 10 Mar, 2018 20:41

HaRT wrote:
Sat 10 Mar, 2018 20:37
Does the plugin support being applied to the selection only?
Yes.
Will it replace the block selection (“vertical”) correctly?
Vertical blocks are not supported. The plugin will refuse to execute on a vertical block.
Can it handle stderr instead of/ together with stdout?
Not at the moment. Only one or the other.
In genera, it would be useful to have an outline of current and planned features (and of known bugs) in the announcement.
All of that is written in the plugin's documentation. I could paste it into the announcement, sure, but then I would have to keep it updated with newer versions.

pepak
Posts: 369
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 5 times
Been thanked: 11 times

Filters

Post by pepak » Sat 10 Mar, 2018 20:44

When fed the selection, can it replace the entire editor contents?
No, it will replace just the block.
Will it preserve/unify EOLs?
It will convert them to default. I don't think there's any other way of handling it because there is no real relation between the lines in the input and in the output.
Can this be toggled?
No.

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

Filters

Post by HaRT » Sat 10 Mar, 2018 20:48

pepak wrote:
Sat 10 Mar, 2018 20:41
I could paste it into the announcement, sure, but then I would have to keep it updated with newer versions.
That would much user-friendlier though.
Фар есть инструмент, а не нянька. © 2009 DrKnS

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

Filters

Post by HaRT » Sat 10 Mar, 2018 20:52

pepak wrote:
Sat 10 Mar, 2018 20:44
It will convert them to default. I don't think there's any other way of handling it because there is no real relation between the lines in the input and in the output.
The obvious options are: use the filter output's EOLs verbatim OR use current editor's EOLs instead (I hope it's what you mean by default).
Фар есть инструмент, а не нянька. © 2009 DrKnS

pepak
Posts: 369
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 5 times
Been thanked: 11 times

Filters

Post by pepak » Sat 10 Mar, 2018 20:53

To be honest, I think my current announcement is pretty much in-line with other people's plugin announcements. Not sure it would be appreciated if I spammed the announcement with a 200+ line text. After all, the brief description present should be sufficient for FAR users to know whether the plugin is completely outside of their need or that it might need a closer investigation.

pepak
Posts: 369
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 5 times
Been thanked: 11 times

Filters

Post by pepak » Sat 10 Mar, 2018 20:55

HaRT wrote:
Sat 10 Mar, 2018 20:52
pepak wrote:
Sat 10 Mar, 2018 20:44
It will convert them to default. I don't think there's any other way of handling it because there is no real relation between the lines in the input and in the output.
The obvious options are: use the filter output's EOLs verbatim OR use current editor's EOLs instead (I hope it's what you mean by default).
Damn. I wanted a reply, not a thank-you. Oh well, I guess it can't hurt :-)

Anyway, yes, the plugin always uses editor's EOLs, since the text is entered using ECTL_SETSTRING with a NULL StringEOL. For the same reason the plugin also uses the editor's encoding.

pepak
Posts: 369
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 5 times
Been thanked: 11 times

Filters

Post by pepak » Sat 10 Mar, 2018 21:28

There you go. More details added. I still don't think that's a good idea though.

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

Filters

Post by HaRT » Tue 13 Mar, 2018 00:43

pepak wrote:
Sat 10 Mar, 2018 10:02
HTML View: This filter makes use of elinks (http://elinks.or.cz)
I failed to find Windows pre-built packages there. Spent significant time to build it myself in 64-bit MinGW (finally, had to change socklen_t to size_t and to add -lregex -L/F/msys64/mingw64/lib/binutils -liberty to LIBS in Makefile.config) — only to see it (both in MinGW terminal and in CMD/FAR). What elinks packages do you use?

pepak
Posts: 369
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 5 times
Been thanked: 11 times

Filters

Post by pepak » Tue 13 Mar, 2018 05:43

I compiled my own using Cygwin (./autogen.sh & ./configure & make), that went without an issue. I failed to compile it using MingW no matter what I tried - even if compilation completed without errors, the executable didn't work.

Before that, I used binaries from here: http://www.paehl.com/open_source/?TextB ... extbrowser

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

Filters

Post by HaRT » Mon 26 Mar, 2018 23:18

Very nice interface trick in Settings to use double frame to indicate that the filters list has focus! It confused me at first but as I started moving around I liked it.

A simple wish: please add histories to the filter properties text fields: Description, File mask, Command template.

A more complex wish: support input of ad-hoc parameters to external filters. E.g. I add a “Sort” filter and then am able to specify the comparison starting column before each run.
It might support the same syntax as built-in metacharacters (in User menu, Apply command): !?$<history>$<title>?<init>! (I wonder if FAR API has a function to handle these in plugins). Or it might be some other syntax.
Фар есть инструмент, а не нянька. © 2009 DrKnS

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

Filters

Post by HaRT » Mon 26 Mar, 2018 23:56

Bug 1: once I input a percent sign into the External Filter's command and press Space, an , the Plugins Configuration menu opens over the dialog once I discard the error message box, and both filter properties and filters list dialogs are unusable as I discard the menu.

Bug 2: the EOL of the last line resulting from the external filter is not inserted to the editor. This results in joining the last filtered line with the next original one.

Bug 3: if I Undo the filtering operation, the initial caret position is not restored.
Фар есть инструмент, а не нянька. © 2009 DrKnS

pepak
Posts: 369
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 5 times
Been thanked: 11 times

Filters

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

HaRT wrote:
Mon 26 Mar, 2018 23:18
Very nice interface trick in Settings to use double frame to indicate that the filters list has focus! It confused me at first but as I started moving around I liked it.
Personally, I hate it, but it looks better than all the alternatives I tried.
A simple wish: please add histories to the filter properties text fields: Description, File mask, Command template.
Are they not there already? If so, I must have overlooked them something, because having the history has always been my intention.
A more complex wish: support input of ad-hoc parameters to external filters. E.g. I add a “Sort” filter and then am able to specify the comparison starting column before each run.
On the TODO list. I wanted to get the plugin out fast and then polish these things. I will definitely be doing that once I settle on a reasonable UX solution.
It might support the same syntax as built-in metacharacters (in User menu, Apply command): !?$<history>$<title>?<init>! (I wonder if FAR API has a function to handle these in plugins). Or it might be some other syntax.
Unfortunately, the built-in syntax is out. I had been looking into it when I was designing the command template, but then decided not to use it:
  • As far as I know, the API for processing of the syntax is not available to the plugins and I definitely do not want to implement it myself.
  • Many (=almost all) of the template options are irrelevant (e.g. "selected files"?).
  • There are no template options for the variables I need.
HaRT wrote:
Mon 26 Mar, 2018 23:56
Bug 1: once I input a percent sign into the External Filter's command and press Space, an "EConvertError: Format 'Unknown '%%%c' at position %d -' invalid or incompatible with argument" appears, the Plugins Configuration menu opens over the dialog once I discard the error message box, and both filter properties and filters list dialogs are unusable as I discard the menu.
The error is mostly intended, if you want a percentage sign, you must double it. What is not correct is the fact that you get an untranslated message, you should see something like "unknown %q at position 10". Will fix.
Bug 2: the EOL of the last line resulting from the external filter is not inserted to the editor. This results in joining the last filtered line with the next original one.
The problem is, I don't know how to detect whether the last filtered line does or does not contain an EOL. But I will look into it.
Bug 3: if I Undo the filtering operation, the initial caret position is not restored.
This is up to FAR, I think. I tell FAR to perform the undo and don't care how it does it. But maybe I am starting the undo process too late? It should start before I move the cursor.
Last edited by pepak on Tue 27 Mar, 2018 06:33, edited 1 time in total.

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

Filters

Post by HaRT » Tue 27 Mar, 2018 14:41

pepak wrote:
Tue 27 Mar, 2018 06:32
Are they not there already?
Nope. Hence the bugreport.
pepak wrote:
Tue 27 Mar, 2018 06:32
I will definitely be doing that once I settle on a reasonable UX solution.
Thanks.
pepak wrote:
Tue 27 Mar, 2018 06:32
Many (=almost all) of the template options are irrelevant (e.g. "selected files"?).
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?
pepak wrote:
Tue 27 Mar, 2018 06:32
if you want a percentage sign, you must double it
What do unescaped percent signs mean? A hint would be useful somewhere in the dialog (or at least in the docs).
pepak wrote:
Tue 27 Mar, 2018 06:32
you should see something like "unknown %q at position 10". Will fix.
Thanks.
But please note that the dialogs are totally unusable after the error now. Or is it what you mean by “untranslated”?
pepak wrote:
Tue 27 Mar, 2018 06:32
It should start before I move the cursor.
I reckon so.
Фар есть инструмент, а не нянька. © 2009 DrKnS

pepak
Posts: 369
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 5 times
Been thanked: 11 times

Filters

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

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.

Post Reply

Return to “General Plug-In Discussions”