Brings gemini bullet-deteciton into line with spec update.
[elpher.git] / elpher.el
index b169f76..3c8db4a 100644 (file)
--- a/elpher.el
+++ b/elpher.el
@@ -4,7 +4,7 @@
 
 ;; Author: Tim Vaughan <plugd@thelambdalab.xyz>
 ;; Created: 11 April 2019
-;; Version: 2.7.6
+;; Version: 2.7.8
 ;; Keywords: comm gopher
 ;; Homepage: http://thelambdalab.xyz/elpher
 ;; Package-Requires: ((emacs "26"))
@@ -70,7 +70,7 @@
 ;;; Global constants
 ;;
 
-(defconst elpher-version "2.7.6"
+(defconst elpher-version "2.7.8"
   "Current version of elpher.")
 
 (defconst elpher-margin-width 6
@@ -358,7 +358,7 @@ If no address is defined, returns 0.  (This is for compatibility with the URL li
   "Retrieve gopher selector from ADDRESS object."
   (if (member (url-filename address) '("" "/"))
       ""
-    (substring (url-filename address) 2)))
+    (url-unhex-string (substring (url-filename address) 2))))
 
 
 ;; Cache
@@ -1151,11 +1151,8 @@ by HEADER-LINE."
 This function uses Emacs' auto-fill to wrap text sensibly to a maximum
 width defined by elpher-gemini-max-fill-width."
   (insert (elpher-process-text-for-display text-line))
-  (let* ((prefix-end-idx (string-match "[^ \t*]" text-line))
-         (fill-prefix (if prefix-end-idx
-                          (let ((raw-prefix (substring text-line 0 prefix-end-idx)))
-                            (replace-regexp-in-string "\*" " " raw-prefix))
-                        nil)))
+  (let* ((prefix-end-idx (string-match "^[ \t]*\\(\*+[ \t]\\)?" text-line))
+         (fill-prefix (replace-regexp-in-string "\*" " " (match-string 0 text-line))))
     (newline)))
 
 (defun elpher-render-gemini-map (data _parameters)
@@ -1791,6 +1788,7 @@ functions which initialize the gopher client, namely
       (switch-to-buffer "*elpher*")
     (switch-to-buffer "*elpher*")
     (setq elpher-current-page nil)
+    (setq elpher-history nil)
     (let ((start-page (elpher-make-page "Elpher Start Page"
                                         (elpher-make-special-address 'start))))
       (elpher-visit-page start-page)))