mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-22 18:52:40 +01:00
Fix misc white-spacing issues
* func sed no longer trims leading whitespace * quoted text no longer trims leading whitespace * no longer convert tabs to spaces in output * no longer condense adjacent whitespace together in output
This commit is contained in:
parent
af2d9844b8
commit
c6f6823df9
@ -699,7 +699,7 @@ sub handle_result($self, $context, $result = $context->{result}) {
|
||||
$context->{original_result} = $result;
|
||||
|
||||
$result =~ s/[\n\r]/ /g unless $preserve_newlines;
|
||||
$result =~ s/[ \t]+/ /g unless $context->{preserve_whitespace};
|
||||
#$result =~ s/[ \t]+/ /g unless $context->{preserve_whitespace};
|
||||
|
||||
my $max_lines = $self->{pbot}->{registry}->get_value($context->{from}, 'max_newlines') // 4;
|
||||
my $lines = 0;
|
||||
@ -1320,6 +1320,9 @@ sub make_args($self, $string, %opts) {
|
||||
# add argument with quotes and spaces preserved
|
||||
push @arglist_unstripped, $arg;
|
||||
|
||||
# strip leading spaces from argument
|
||||
$arg =~ s/^\s+//;
|
||||
|
||||
# strip quotes from argument
|
||||
if ($arg =~ m/^'.*'$/) {
|
||||
$arg =~ s/^'//;
|
||||
@ -1329,9 +1332,6 @@ sub make_args($self, $string, %opts) {
|
||||
$arg =~ s/"$//;
|
||||
}
|
||||
|
||||
# strip leading spaces from argument
|
||||
$arg =~ s/^\s+//;
|
||||
|
||||
# add stripped argument
|
||||
push @arglist, $arg;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ sub func_sed($self, @rest) {
|
||||
my $text = "@rest";
|
||||
|
||||
my $result = eval {
|
||||
if ($text =~ /^s(.)(.*?)(?<!\\)\1(.*?)(?<!\\)\1(\S*)\s+(.*)/p) {
|
||||
if ($text =~ /^s(.)(.*?)(?<!\\)\1(.*?)(?<!\\)\1(\S*)\s(.*)/p) {
|
||||
my ($a, $r, $g, $m, $t) = ($5, "'\"$3\"'", index($4, "g") != -1, $4, $2);
|
||||
|
||||
#print "a: $a, r: $r, g: $g, m: $m, t: $t\n";
|
||||
|
@ -25,7 +25,7 @@ use PBot::Imports;
|
||||
# These are set by the /misc/update_version script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 4821,
|
||||
BUILD_REVISION => 4822,
|
||||
BUILD_DATE => "2024-11-02",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user