return;
}
+
+ sub prompt {
+ my ($self, %settings) = @_;
+
+ foreach (keys %settings) {
+ die if not exists $self->{prompt}{$_};
+ $self->{prompt}{$_} = $settings{$_};
+ }
+ return;
+ }
+
+
+ sub debug {
+ my ($self, $module, @args) = @_;
+
+ return if not $self->{debug};
+
+ state $fh; # only open the file once per run
+ if (not defined $fh) {
+ # Ignore errors if the directory doesn't exist.
+ if (not open $fh, '>', "$ENV{HOME}/.config/fcscs/log") {
+ $fh = undef; # a failed open still writes a value to $fh
+ return;
+ }
+ $fh->autoflush(1);
+ }
+
+ foreach (@args) {
+ $_ = $self->encode($_);
+ }
+ say $fh "$module: @args" or die $!;
+ return;
+ }
sub die {
my ($self, @args) = @_;
$self->deinit;
exit 1;
}
- sub debug {
- my ($self, $module, @args) = @_;
-
- return if not $self->{debug};
-
- state $fh; # only open the file once per run
- if (not defined $fh) {
- # Ignore errors if the directory doesn't exist.
- if (not open $fh, '>', "$ENV{HOME}/.config/fcscs/log") {
- $fh = undef; # a failed open still writes a value to $fh
- return;
- }
- $fh->autoflush(1);
- }
-
- foreach (@args) {
- $_ = $self->encode($_);
- }
- say $fh "$module: @args" or CORE::die $!;
- return;
- }
-
-
- sub prompt {
- my ($self, %settings) = @_;
-
- foreach (keys %settings) {
- CORE::die if not exists $self->{prompt}{$_};
- $self->{prompt}{$_} = $settings{$_};
- }
- return;
- }
# Wrapper for Curses.
sub width { return $Curses::COLS; }
} elsif ($char eq '$') { # select to end of line
extend_match_regex_right($line, $match, qr/.+/);
- # Allow mode changes if not overwritten by local mappings.
+ # Allow mode changes if not overwritten by above mappings.
} elsif (defined $config->{mapping}{mode}{$char}) {
$screen->draw_matches($config, [$match_old], []); # clear match
return { key => $char };