aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2020-07-31 13:33:26 +0000
committerDavid Spickett <david.spickett@linaro.org>2020-07-31 13:45:03 +0000
commit638f46d091f8c99258f99895e7eefcbc58918ab4 (patch)
tree16eaac964ba8a76f74c938df9d7d692940924c1c
parentUpdate ChangeLog (diff)
downloadw3m-638f46d091f8c99258f99895e7eefcbc58918ab4.tar.gz
w3m-638f46d091f8c99258f99895e7eefcbc58918ab4.zip
Show keyboard shortcuts in a consistent order in help
Perl's hash variables are not ordered so each time we run the CGI script for the help page we may get a different order. This caused bindings and names to appear differently on each reload. To fix this sort by keys when generating the shortcut tables. Fixes #133
Diffstat (limited to '')
-rw-r--r--scripts/w3mhelp.cgi.in24
1 files changed, 14 insertions, 10 deletions
diff --git a/scripts/w3mhelp.cgi.in b/scripts/w3mhelp.cgi.in
index 348d5df..11f9b68 100644
--- a/scripts/w3mhelp.cgi.in
+++ b/scripts/w3mhelp.cgi.in
@@ -72,22 +72,26 @@ local (%funckeydesc, $key, $fname, $desc);
%funcname = (%funcname, %buf_funcname, %lineedit_funcname, %menu_funcname);
%funcdesc = (%funcdesc, %buf_funcdesc, %lineedit_funcdesc, %menu_funcdesc);
-while (($fname, $desc) = each %funcdesc) {
- $funckeydesc{$funcname{$fname}} = "$fname\n$desc\n";
+# sort for consistent order each time this is run
+foreach my $fname (sort keys %funcdesc) {
+ $funckeydesc{$funcname{$fname}} = "$fname\n$funcdesc{$fname}\n";
}
-while (($key, $fname) = each %keyfunc) {
+foreach $key (sort keys %keyfunc) {
$keydata{$key} && next;
- $funckeydesc{$funcname{$fname}} .= "$key,";
+ $funckeydesc{$funcname{$keyfunc{$key}}} .= "$key,";
}
-while (($key, $fname) = each %buf_keyfunc) {
- $funckeydesc{$funcname{$fname}} .= "$key,";
+foreach $key (sort keys %buf_keyfunc) {
+ $keydata{$key} && next;
+ $funckeydesc{$funcname{$buf_keyfunc{$key}}} .= "$key,";
}
-while (($key, $fname) = each %lineedit_keyfunc) {
- $funckeydesc{$funcname{$fname}} .= "$key,";
+foreach $key (sort keys %lineedit_keyfunc) {
+ $keydata{$key} && next;
+ $funckeydesc{$funcname{$lineedit_keyfunc{$key}}} .= "$key,";
}
-while (($key, $fname) = each %menu_keyfunc) {
- $funckeydesc{$funcname{$fname}} .= "$key,";
+foreach $key (sort keys %menu_keyfunc) {
+ $keydata{$key} && next;
+ $funckeydesc{$funcname{$menu_keyfunc{$key}}} .= "$key,";
}
print <<HEADING;