diff options
Diffstat (limited to 'gmi.pl')
-rwxr-xr-x | gmi.pl | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -26,10 +26,7 @@ use warnings; use feature qw(refaliasing); no warnings qw(experimental::refaliasing); -our $VERSION = 'v1.0.0'; - -# TODO: -# back() only works once; should fix this +our $VERSION = 'v1.0.1'; # Modules use IO::Socket::SSL; # CPAN @@ -96,6 +93,7 @@ if (! -e $xdg_cache) { ### $xdg_config ### $xdg_data ### $xdg_cache +my @cache; load_config(); my $wrapper = Text::Wrapper->new(columns=>$config{textwrap}, body_start=>''); @@ -142,7 +140,7 @@ my %commands = ( 'hist' => [sub { hist() }, 'Returns history.' ], 'h' => [sub { hist() }, 'Alias of `hist\'.' ], - 'back' => [sub { back(0) }, 'Go back in history.' ], + 'back' => [sub { back(0) }, 'Go back in history, once. The previously accessed URI is cached.' ], 'b' => [sub { back(0) }, 'Alias of `back\'.' ], 'backnodisplay' => [sub { back(1) }, 'Go back in history but do not display the page' . @@ -306,6 +304,9 @@ sub url { ### $current_url ### $url + if (@doc) { + @cache = @doc; + } undef(@doc); if (peer_cert($cl, $url->{host})) { @@ -823,7 +824,17 @@ sub back { $config{doc_out} = 0 if ($display == 1); if (@history >= 2) { - url("$history[-2][0]"); + $current_url="$history[-2][0]"; + if (@cache) { + my @array = @doc; + @doc = @cache; + @cache = @array; + display(); + } + else { + # when the user just started the program and types 'back' and has history + url("$history[-2][0]"); + } } else { print $OUT "No such history there."; |