mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
added support for leading/trailing '/' in tag matching...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7327520c0f
commit
158da70086
@ -816,6 +816,15 @@ actions.Actions({
|
||||
config: {
|
||||
},
|
||||
|
||||
// NOTE: resetting this option will clear the last direction...
|
||||
toggleShiftsAffectDirection: ['Interface/Shifts affect direction',
|
||||
core.makeConfigToggler('shifts-affect-direction',
|
||||
['off', 'on'],
|
||||
function(action){
|
||||
action == 'on'
|
||||
&& (delete this.__direction_last) })],
|
||||
|
||||
|
||||
// basic ribbon editing...
|
||||
//
|
||||
// NOTE: for all of these, current/ribbon image is a default...
|
||||
@ -830,15 +839,6 @@ actions.Actions({
|
||||
return this.current_ribbon == this.base && 'disabled' }},
|
||||
function(target){ this.data.setBase(target) }],
|
||||
|
||||
// NOTE: resetting this option will clear the last direction...
|
||||
toggleShiftsAffectDirection: ['Interface/Shifts affect direction',
|
||||
core.makeConfigToggler('shifts-affect-direction',
|
||||
['off', 'on'],
|
||||
function(action){
|
||||
action == 'on'
|
||||
&& (delete this.__direction_last) })],
|
||||
|
||||
|
||||
// NOTE: this does not retain direction information, handle individual
|
||||
// actions if that info is needed.
|
||||
// NOTE: to make things clean, this is triggered in action handlers
|
||||
|
||||
@ -306,6 +306,8 @@ var TagsPrototype = {
|
||||
// Query syntax:
|
||||
// a - tag
|
||||
// a/b - path, defines a directional relation between a and b
|
||||
// /a - path special case, matches iff a is at path root
|
||||
// a/ - path special case, matches iff a is at path base
|
||||
// a:b - set, defines a non-directional relation between a and b
|
||||
// * - tag placeholder, matches one and only one tag name
|
||||
//
|
||||
@ -371,6 +373,9 @@ var TagsPrototype = {
|
||||
|
||||
// match two tags...
|
||||
} else {
|
||||
var root = /^\s*[\\\/]/.test(a)
|
||||
var base = /[\\\/]\s*$/.test(a)
|
||||
|
||||
// normalized match...
|
||||
a = this.normalize(a)
|
||||
b = this.normalize(b)
|
||||
@ -405,7 +410,13 @@ var TagsPrototype = {
|
||||
// tag compatibility deeper in matchSet(..)...
|
||||
var sa = a.split(/[\/\\]/g)
|
||||
var sb = b.split(/[\/\\]/g)
|
||||
return sb
|
||||
return (
|
||||
// fail if base/root fails...
|
||||
(root && !matchSet(sa[0], sb[0])
|
||||
|| (base && !matchSet(sa[sa.length-1], sb[sb.length-1]))) ?
|
||||
false
|
||||
// normal test...
|
||||
: sb
|
||||
.reduce(function(a, e){
|
||||
return (a[0]
|
||||
&& (a[0] == '*'
|
||||
@ -413,7 +424,7 @@ var TagsPrototype = {
|
||||
a.slice(1)
|
||||
: a
|
||||
}, sa)
|
||||
.length == 0
|
||||
.length == 0)
|
||||
}
|
||||
},
|
||||
|
||||
@ -448,6 +459,8 @@ var TagsPrototype = {
|
||||
match: function(a, b, cmp){
|
||||
var that = this
|
||||
|
||||
var edge = /^\s*[\\\/]/.test(a) || /[\\\/]\s*$/.test(a)
|
||||
|
||||
var res = this.directMatch(...arguments)
|
||||
|
||||
// get paths with tag...
|
||||
@ -462,7 +475,8 @@ var TagsPrototype = {
|
||||
seen = seen || new Set()
|
||||
return paths(tag)
|
||||
.reduce(function(res, path){
|
||||
if(res == true){
|
||||
if(res == true
|
||||
|| (edge && !that.directMatch(a, path))){
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user