sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 80787b8bed9269e0d0fe2c1570c7e4ec6183e1c1
parent 86709abacd87f392f813d72a9a3e3a08553649b5
Author: Matthieu Rakotojaona <matthieu.rakotojaona@gmail.com>
Date:   Mon,  6 Oct 2014 20:33:25 +0200

Merge branch 'goto-for-html' into develop

Diffstat:
M lib/sup/modes/thread_view_mode.rb | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/sup/modes/thread_view_mode.rb b/lib/sup/modes/thread_view_mode.rb
@@ -733,8 +733,14 @@ EOS
   end
 
   def goto_uri
-    return unless (chunk = @chunk_lines[curpos]) && chunk.is_a?(Chunk::Text)
-    return unless HookManager.enabled? "goto"
+    unless (chunk = @chunk_lines[curpos])
+      BufferManager.flash "No URI found."
+      return
+    end
+    unless HookManager.enabled? "goto"
+      BufferManager.flash "You must add a goto.rb hook before you can goto a URI."
+      return
+    end
 
     # @text is a list of lines with this format:
     # [
@@ -746,7 +752,7 @@ EOS
       .take_while{|d| d[0] == :text_color and d[1].strip != ""} # Only take up to the first "" alone on its line
       .map{|d| d[1].strip}.join("").strip
 
-
+    found = false
     (linetext || "").scan(URI::regexp).each do |matches|
       begin
         link = $& # ruby magic: $& is the whole regexp match
@@ -758,12 +764,14 @@ EOS
         BufferManager.flash "Going to #{reallink} ..."
         HookManager.run "goto", :uri => reallink
         BufferManager.completely_redraw_screen
+        found = true
 
       rescue URI::InvalidURIError => e
         debug "not a uri: #{e}"
         # Do nothing, this is an ok flow
       end
     end
+    BufferManager.flash "No URI found." unless found
   end
 
 private