X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fsup%2Fmodes%2Fthread-index-mode.rb;h=7b87bf66ba9112a3fb20a465a540f6c0eef085ba;hb=63a9172e8e5524c76978f1e6438b3d856c2abda9;hp=610828e62fa1fd705d570b0ae417b388739d1900;hpb=6461b6b5c80b216627127837942b761a151317b5;p=sup diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index 610828e..7b87bf6 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -42,7 +42,7 @@ EOS k.add :toggle_tagged, "Tag/untag selected thread", 't' k.add :toggle_tagged_all, "Tag/untag all threads", 'T' k.add :tag_matching, "Tag matching threads", 'g' - k.add :apply_to_tagged, "Apply next command to all tagged threads", ';' + k.add :apply_to_tagged, "Apply next command to all tagged threads", '+' k.add :join_threads, "Force tagged threads to be joined into the same thread", '#' k.add :undo, "Undo the previous action", 'u' end @@ -80,6 +80,7 @@ EOS end end + def unsaved?; dirty? end def lines; @text.length; end def [] i; @text[i]; end def contains_thread? t; @threads.include?(t) end @@ -510,9 +511,14 @@ EOS end def tag_matching - query = BufferManager.ask :search, "tag threads matching: " + query = BufferManager.ask :search, "tag threads matching (regex): " return if query.nil? || query.empty? - query = /#{query}/i + query = begin + /#{query}/i + rescue RegexpError => e + BufferManager.flash "error interpreting '#{query}': #{e.message}" + return + end @mutex.synchronize { @threads.each { |t| @tags.tag t if thread_matches?(t, query) } } regen_text end @@ -844,7 +850,6 @@ protected (t.labels - @hidden_labels).map { |label| [:label_color, "+#{label} "] } + [[:snippet_color, snippet] ] - end def dirty?; @mutex.synchronize { (@hidden_threads.keys + @threads).any? { |t| t.dirty? } } end