aboutsummaryrefslogtreecommitdiff
path: root/gmi.pl
diff options
context:
space:
mode:
Diffstat (limited to 'gmi.pl')
-rwxr-xr-xgmi.pl37
1 files changed, 27 insertions, 10 deletions
diff --git a/gmi.pl b/gmi.pl
index eddf798..ba0c34e 100755
--- a/gmi.pl
+++ b/gmi.pl
@@ -75,6 +75,12 @@ my $control_frame = $top->Frame()
-fill=>'x',
-expand=>0,
);
+my $back_botton = $control_frame->Button(
+ -text=>'Back',
+ -command=>\&back,
+ )->pack(
+ -side=>'left',
+ );
my $label = $control_frame->Label(
-text=>'URL:',
)->pack(
@@ -84,8 +90,9 @@ my $entry = $control_frame->Entry(
)->pack(
-side=>'left',
-expand=>1,
+ -fill=>'x',
);
-my $buttom = $control_frame->Button(
+my $button = $control_frame->Button(
-text=>'Go!',
-command=>\&go_to_url,
)->pack(
@@ -100,9 +107,11 @@ my $body_frame = $top->Frame()
);
my $t = $body_frame->Scrolled(
'TextANSIColor',
- -relief=>'sunken',
+ -relief=>'groove',
-borderwidth=>2,
-setgrid=>'true',
+ -wrap=>'word',
+ -font=>'arimo 12',
#-height=>30,
-scrollbars=>'e',
#-font => 'fixed',
@@ -111,8 +120,7 @@ my $t = $body_frame->Scrolled(
-fill=>'both',
);
-my $something = "hello world";
-$t->insert('0.0', "$something");
+$t->insert('0.0', "Type in a valid domain name then press 'Go!'");
my %config = (
'use_pager' => 1,
@@ -181,6 +189,11 @@ sub show_to_user {
)->pack();
}
+sub update_entry_Tk_url {
+ $entry->delete(0,'end');
+ $entry->insert(0.0,$_[0]);
+}
+
sub url {
my ($url) = @_;
### $url
@@ -237,6 +250,7 @@ sub url {
$current_url = return_url($url);
### $current_url
### $url
+ update_entry_Tk_url($current_url);
if (@doc) {
@cache = @doc;
@@ -753,16 +767,18 @@ sub back {
### @_
### $display
- my $dok_out = $config{doc_out};
+ #my $dok_out = $config{doc_out};
- $config{doc_out} = 0 if ($display == 1);
+ #$config{doc_out} = 0 if ($display == 1);
if (@history >= 2) {
$current_url="$history[-2][0]";
+ update_entry_Tk_url($current_url);
if (@cache) {
my @array = @doc;
@doc = @cache;
@cache = @array;
+ get_links();
update_history( ["$current_url", "back"] );
display() if (! $display);
}
@@ -776,7 +792,7 @@ sub back {
}
### @history
- $config{doc_out} = $dok_out if ($display == 1);
+ #$config{doc_out} = $dok_out if ($display == 1);
}
sub display {
@@ -786,13 +802,14 @@ sub display {
_pre_block($line);
if ((substr($line,0,2)) eq '=>' and not $pre_block) {
$line =~ m/^=>[\s]*([\w\d\-\\\/\.\:\~\?\=\#]+)[\s]*(.+)?$/;
+ my $_line;
if ($2) {
- $line = colored("[". ($counter+1) . _is_not_scheme_gemini($1) . "]",'underline') . " $2\n";
+ $_line = colored("[". ($counter+1) . _is_not_scheme_gemini($1) . "]",'underline') . " $2\n";
}
else {
- $line = colored("[" . ($counter+1) . _is_not_scheme_gemini($1) . "]",'underline') . " $1\n";
+ $_line = colored("[" . ($counter+1) . _is_not_scheme_gemini($1) . "]",'underline') . " $1\n";
}
- $t->insert('end', "$line", "URL$counter");
+ $t->insert('end', "$_line", "URL$counter");
$counter++;
}
else {