ranger-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ranger-users] ranger 1.6.0 on the horizon


From: Joshua Landau
Subject: Re: [Ranger-users] ranger 1.6.0 on the horizon
Date: Sat, 16 Feb 2013 22:35:40 +0000

>On 16 February 2013 21:11, Miodrag Milic <address@hidden> wrote:
>>You could just wait until it's properly formed before continuing. But then..
>>"\." changes to "\.*..*", which isn't what you wanted..
>>"[ab]" changes to "[.*a.*b.*].*", which isn't what you wanted..
>>"(ab)" changes to "(.*a.*b.*).*", which isn't what you wanted..
>If its implemented without RE, it should still have ^ and $ options. Perhaps hotkey to switch travel "mode" from current one (with special chars ?escaped, except ^$ ) to full blown RE. Even third mode could be made (the one that doesn't skip letters, like find ATM). That way you have all options and in .conf file you could specify default mode.

The thing is, I can only think of one way to use Regex that isn't buggy: don't skip letters.

If we're only using Regex for "^" and "$", just use this (you can leave :travel as-is, and it will change itself):


which matches properly like Regex, but supports more for your money.

It matches both the symbol interpretation and the "Regex" interpretation so you don't have to escape, and allows chaining.

THIS <=> REGEX (please note I don't use Regex much)

# Mixed interpretation
"^a" <=> "(^a)|(\^a)"
"a$" <=> "(a$)|(a\$)"

# +Chaining
"^a^b" <=> "(^ab)|(^a.*\^.*b)|(\^.*a.*\^.*b)" [?]

FOR EXAMPLE:
"^a^b^cdefg$h$i$" matches "abc_d_e_f_ghi" and "ab_^_c_d_e_f_g_$_hi" and so on.

And if you don't like it exactly like this (I think it's useful), the implementation is ours and thus is easy to change. There are multiple reasons I chose this double-interpretation version, including the fact it stops cases where adding letters increases the number of results (excluding chained endings). That would be bad because it can trigger :travel early, but Regex would have an abundance of those cases.

An even better approach *might* be:

"start^middle$dne"

Where "middle" can have 'holes' in but "start" and "dne" cannot. The reason for "dne" instead of "end" is to prevent the intermediate "$e" matching things ending in "e", which could trigger :travel early.

The important thing is that none of these can be obviously made with full Regex support. If they can be, how they do so is beyond me*. Hence, plain Regex (no letter skipping), buggy Regex or no Regex.

So:

>If its implemented without RE, it should still have ^ and $ options.
Oui, see above.

>Perhaps hotkey to switch travel "mode" from current one (with special chars escaped, except ^$ )
That would be identical to a not-Regex mode similar to above, (but less useful than above, methinks). Hence there is no reason to use Regex.

>to full blown RE
Can't happen*, that's the problem. If you have full Regex, it's near-impossible to have letter-skipping. Unless I'm missing something.

>Even third mode could be made (the one that doesn't skip letters, like find ATM)
That's possible, but why? Surely[?] you wouldn't use Regex that much. :travel was intended for fast travel, not fidelity. There might be a use-case, but I'm not seeing it.

>That way you have all options and in .conf file you could specify default mode.
If there are two modes, Regex and not-Regex, the use-cases might be distinct enough to warrant separate commands.

* I have one solution, but it'd be about 1000x less algorithmically efficient in the medium case ;)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]