Fixed indentation in clipboard
This commit is contained in:
parent
cb32065c87
commit
d5a57b0266
54
clipboard
54
clipboard
@ -18,48 +18,48 @@
|
|||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
sub copy {
|
sub copy {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
open(CLIPBOARD, "| xsel -ib");
|
open(CLIPBOARD, "| xsel -ib");
|
||||||
my $sel = $self->selection();
|
my $sel = $self->selection();
|
||||||
utf8::encode($sel);
|
utf8::encode($sel);
|
||||||
print CLIPBOARD $sel;
|
print CLIPBOARD $sel;
|
||||||
close(CLIPBOARD);
|
close(CLIPBOARD);
|
||||||
|
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
|
|
||||||
sub paste {
|
sub paste {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my $str = `xsel -ob`;
|
my $str = `xsel -ob`;
|
||||||
$str =~ tr/\n/\r/;
|
$str =~ tr/\n/\r/;
|
||||||
$self->tt_write($str);
|
$self->tt_write($str);
|
||||||
|
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
|
|
||||||
sub paste_escaped {
|
sub paste_escaped {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my $str = `xsel -ob`;
|
my $str = `xsel -ob`;
|
||||||
$str =~ tr/\n/\r/;
|
$str =~ tr/\n/\r/;
|
||||||
$str =~ s/([!#\$%&\*\(\) ='"\\\|\[\]`~,<>\?])/\\\1/g;
|
$str =~ s/([!#\$%&\*\(\) ='"\\\|\[\]`~,<>\?])/\\\1/g;
|
||||||
$self->tt_write($str);
|
$self->tt_write($str);
|
||||||
|
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
|
|
||||||
sub on_user_command {
|
sub on_user_command {
|
||||||
my ($self, $cmd) = @_;
|
my ($self, $cmd) = @_;
|
||||||
|
|
||||||
if ($cmd eq "clipboard:copy") {
|
if ($cmd eq "clipboard:copy") {
|
||||||
$self->copy;
|
$self->copy;
|
||||||
} elsif ($cmd eq "clipboard:paste") {
|
} elsif ($cmd eq "clipboard:paste") {
|
||||||
$self->paste;
|
$self->paste;
|
||||||
} elsif ($cmd eq "clipboard:paste_escaped") {
|
} elsif ($cmd eq "clipboard:paste_escaped") {
|
||||||
$self->paste_escaped;
|
$self->paste_escaped;
|
||||||
}
|
}
|
||||||
|
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user