From 00bb8d7a7ac887d3599a2cc33e6cf363d471da96 Mon Sep 17 00:00:00 2001 From: jake Date: Fri, 4 Feb 2022 14:30:49 -0500 Subject: back() will recall links from cache --- gmi.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'gmi.pl') diff --git a/gmi.pl b/gmi.pl index 8482c86..deb5def 100755 --- a/gmi.pl +++ b/gmi.pl @@ -38,7 +38,7 @@ use Term::ANSIColor; # Core use Path::Naive qw(normalize_path); # CPAN use Text::ParseWords; # Core use Term::ReadLine; # CPAN -#use Smart::Comments; # CPAN +use Smart::Comments; # CPAN use URI::Encode qw(uri_encode); # CPAN use IO::Socket::SSL::Utils; # CPAN use File::Slurper qw(read_dir read_text); # CPAN @@ -94,6 +94,7 @@ if (! -e $xdg_cache) { ### $xdg_data ### $xdg_cache my @cache; +my @cache_links; load_config(); my $wrapper = Text::Wrapper->new(columns=>$config{textwrap}, body_start=>''); @@ -306,6 +307,7 @@ sub url { if (@doc) { @cache = @doc; + @cache_links = @links; } undef(@doc); if (peer_cert($cl, $url->{host})) { @@ -825,10 +827,14 @@ sub back { if (@history >= 2) { $current_url="$history[-2][0]"; - if (@cache) { - my @array = @doc; + if ($cache[0]) { + my @dok = @doc; + my @linkz = @links; + @doc = @cache; - @cache = @array; + @links = @cache_links; + @cache = @dok; + @cache_links = @linkz; update_history( ["$current_url", "back"] ); display() if (! $display); } -- cgit v1.2.3