Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate %matching_marks #30

Closed
white-dragon opened this issue Dec 29, 2019 · 0 comments
Closed

deprecate %matching_marks #30

white-dragon opened this issue Dec 29, 2019 · 0 comments

Comments

@white-dragon
Copy link

white-dragon commented Dec 29, 2019

here two simple (same) patches:

--- tabbedex.utf8	2019-12-29 21:02:07.025578848 +0300
+++ tabbedex	2019-12-29 21:35:42.596547420 +0300
@@ -1011,11 +1011,11 @@
 	my $root = shift;
 	my $timeouts = shift // '';
 	my $re = qr/(?:\d+)?\.\d+|\d+/;
-	$re = eval { qr/\G($re):(\X)(?::|$)/ } // qr/\G($re):(.)(?::|$)/;
+	$re = eval { qr/\G($re):(\X)(\X)?(?::|$)/ } // qr/\G($re):(.)(.)?(?::|$)/;
 	my @timeouts;
 	while ($timeouts =~ /$re/g) {
 		my $left = $root->special_encode($2);
-		push @timeouts, [$1 + 0, $left, $matching_marks{$2} // $left];
+		my $right = $root->special_encode($3) if defined $3;
+		push @timeouts, [$1 + 0, $left, $right // $matching_marks{$2} // $left];
 	}
 	@timeouts = sort { $b->[0] <=> $a->[0] } @timeouts;
 	if (!@timeouts || $timeouts[$#timeouts][0] > 0) {

and

--- tabbedex.utf8	2019-12-29 21:02:07.025578848 +0300
+++ tabbedex	2019-12-29 22:10:05.096447474 +0300
@@ -1005,17 +1005,16 @@
 
 {
 
-my %matching_marks = ('[' => ']', '{' => '}', '(' => ')', '<' => '>');
-
 sub parse_timeouts {
 	my $root = shift;
 	my $timeouts = shift // '';
 	my $re = qr/(?:\d+)?\.\d+|\d+/;
-	$re = eval { qr/\G($re):(\X)(?::|$)/ } // qr/\G($re):(.)(?::|$)/;
+	$re = eval { qr/\G($re):(\X)(\X)?(?::|$)/ } // qr/\G($re):(.)(.)?(?::|$)/;
 	my @timeouts;
 	while ($timeouts =~ /$re/g) {
 		my $left = $root->special_encode($2);
-		push @timeouts, [$1 + 0, $left, $matching_marks{$2} // $left];
+		my $right = $root->special_encode($3) if defined $3;
+		push @timeouts, [$1 + 0, $left, $right // $left];
 	}
 	@timeouts = sort { $b->[0] <=> $a->[0] } @timeouts;
 	if (!@timeouts || $timeouts[$#timeouts][0] > 0) {

1st just add functional, 2nd also remove useless %matching_marks (but broke backward compatibility (does any one use it?))

now u can use any pairs of 'brackets'
for example :URxvt.tabbedex.tabbar-timeouts: 0:)(:1:}{:2:][:3:><
or something like this, after patching utf8 (#29):
URxvt.tabbedex.tabbar-timeouts: 0:⣿:1:⣟⣻:2:⢯⡽:3:⢵⡺:4:⡬⡓:5:⢔⠙:6:⠌⢂:7:·

ps: im going write generator of blowing tabs :)

@mina86 mina86 closed this as completed in 78e57bd Dec 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant