Add a keybinding for displaying current page URI - sacc - sacc(omys), simple console gopher client
git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
Log
Files
Refs
Tags
LICENSE
---
commit 0a187a5d95a708254d99a2cdec6bb54b732481a1
parent 7ab95c658cf1dd546ec39603851742db65233204
Author: Quentin Rameau 
Date:   Mon, 28 Oct 2019 01:17:23 +0100

Add a keybinding for displaying current page URI

Diffstat:
  M config.def.h                        |       3 ++-
  M ui_ti.c                             |       9 +++++++--
  M ui_txt.c                            |       4 ++++

3 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/config.def.h b/config.def.h
@@ -11,7 +11,8 @@
 #define _key_end        'G' /* move to the bottom of page */
 #define _key_pgnext        'l' /* view highlighted item */
 #define _key_pgprev        'h' /* view previous item */
-#define _key_uri        'u' /* print item uri */
+#define _key_cururi        'U' /* print page uri */
+#define _key_seluri        'u' /* print item uri */
 #define _key_fetch        'L' /* refetch current item */
 #define _key_help        '?' /* display help */
 #define _key_quit        'q' /* exit sacc */
diff --git a/ui_ti.c b/ui_ti.c
@@ -118,7 +118,8 @@ help(Item *entry)
                        S(_key_search) ": search current page.\n"
                        S(_key_searchnext) ": search string forward.\n"
                        S(_key_searchprev) ": search string backward.\n"
-                       S(_key_uri) ": print item uri.\n"
+                       S(_key_cururi) ": print page URI.\n"
+                       S(_key_seluri) ": print item URI.\n"
                        S(_key_help) ": show this help.\n"
                        "^D, " S(_key_quit) ": exit sacc.\n"
         };
@@ -536,7 +537,11 @@ uiselectitem(Item *entry)
                         if (entry->raw)
                                 continue;
                         return entry;
-                case _key_uri:
+                case _key_cururi:
+                        if (dir)
+                                displayuri(entry);
+                        continue;
+                case _key_seluri:
                         if (dir)
                                 displayuri(&dir->items[dir->curline]);
                         continue;
diff --git a/ui_txt.c b/ui_txt.c
@@ -48,6 +48,7 @@ help(void)
 {
         puts("Commands:\n"
              "N = [1-9]...: browse item N.\n"
+             "U: print page uri.\n"
              "uN...: print item N uri.\n"
              "0: browse previous item.\n"
              "n: show next page.\n"
@@ -300,6 +301,9 @@ uiselectitem(Item *entry)
                         if (entry->raw)
                                 continue;
                         return entry;
+                case 'U':
+                        printuri(entry, 0);
+                        continue;
                 case 'u':
                         if (item > 0 && item <= nitems)
                                 printuri(&dir->items[item-1], item);