* [sup-talk] Problems with undo archive and thread focus @ 2009-11-05 8:27 Matthias Guedemann 2009-11-12 17:30 ` Andrew Pimlott 0 siblings, 1 reply; 4+ messages in thread From: Matthias Guedemann @ 2009-11-05 8:27 UTC (permalink / raw) To: sup-talk Hi, while using sup for a while now I came across surprising behavior in the following situations. One is, if you hit 'a' in thread view mode, the thread is archived but undo does not work. If you go back to index view and hit 'u' the just archived thread does not appear, but the one before. The second is, if I respond to a thread and send the mail, I normally want to either archive that mail directly or label and archive it. But the thread is put to the front and the focus is on the last place of the thread. Therefore I sometimes archive the wrong thread (but undo comes in handy) The first seems to be a bug, the second may be a problem only for me. best regards, Matthias -- __________________________________________________________ ___ __ __ Dipl. Inf. Matthias Guedemann / __\/ _\ /__\ Computer Systems in Engineering / / \ \ /_\ Otto-von-Guericke Universitaet Magdeburg / /___ _\ \//__ Tel.: 0391 / 67-19359 \____/ \__/\__/ __________________________________________________________ _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [sup-talk] Problems with undo archive and thread focus 2009-11-05 8:27 [sup-talk] Problems with undo archive and thread focus Matthias Guedemann @ 2009-11-12 17:30 ` Andrew Pimlott 2009-11-16 9:42 ` Matthias Guedemann 2009-11-20 4:51 ` Rich Lane 0 siblings, 2 replies; 4+ messages in thread From: Andrew Pimlott @ 2009-11-12 17:30 UTC (permalink / raw) To: sup-talk Excerpts from Matthias Guedemann's message of Thu Nov 05 00:27:25 -0800 2009: > One is, if you hit 'a' in thread view mode, the thread is archived but undo does > not work. If you go back to index view and hit 'u' the just archived thread does > not appear, but the one before. I was annoyed by this too and found that undo is minimally implemented. I added undo to thread view, at least for the cases that I care about or were easy. I have to say I was discouraged that this was necessary: the code to archive a thread should all be in one place, and the undo record should be created there. There's a lot of code duplication, and I can't tell if it's because the model and view are too coupled, or because nobody has bothered to factor it out. The patch is appended. (This is the first time I've done this with git.) > The second is, if I respond to a thread and send the mail, I normally want to > either archive that mail directly or label and archive it. But the thread is put > to the front and the focus is on the last place of the thread. Therefore I > sometimes archive the wrong thread (but undo comes in handy) That's the next most annying thing for me. Hope to get a chance to work on it. Andrew Subject: [PATCH] create undo records in thread view --- lib/sup/modes/thread-view-mode.rb | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index 81197c2..2f2d564 100644 --- a/lib/sup/modes/thread-view-mode.rb +++ b/lib/sup/modes/thread-view-mode.rb @@ -254,7 +254,8 @@ EOS end def edit_labels - reserved_labels = @thread.labels.select { |l| LabelManager::RESERVED_LABELS.include? l } + old_labels = @thread.labels + reserved_labels = old_labels.select { |l| LabelManager::RESERVED_LABELS.include? l } new_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", @thread.labels return unless new_labels @@ -262,6 +263,10 @@ EOS new_labels.each { |l| LabelManager << l } update UpdateManager.relay self, :labeled, @thread.first + UndoManager.register "labeling thread" do + @thread.labels = old_labels + UpdateManager.relay self, :labeled, @thread.first + end end def toggle_starred @@ -476,6 +481,10 @@ EOS dispatch op do @thread.remove_label :inbox UpdateManager.relay self, :archived, @thread.first + UndoManager.register "archiving 1 thread" do + @thread.apply_label :inbox + UpdateManager.relay self, :unarchived, @thread.first + end end end @@ -483,6 +492,10 @@ EOS dispatch op do @thread.apply_label :spam UpdateManager.relay self, :spammed, @thread.first + UndoManager.register "marking 1 thread as spam" do + @thread.remove_label :spam + UpdateManager.relay self, :unspammed, @thread.first + end end end @@ -490,6 +503,10 @@ EOS dispatch op do @thread.apply_label :deleted UpdateManager.relay self, :deleted, @thread.first + UndoManager.register "deleting 1 thread" do + @thread.remove_label :deleted + UpdateManager.relay self, :undeleted, @thread.first + end end end -- 1.5.6.5 -- I've decided to go back to school. Kindergarden. _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [sup-talk] Problems with undo archive and thread focus 2009-11-12 17:30 ` Andrew Pimlott @ 2009-11-16 9:42 ` Matthias Guedemann 2009-11-20 4:51 ` Rich Lane 1 sibling, 0 replies; 4+ messages in thread From: Matthias Guedemann @ 2009-11-16 9:42 UTC (permalink / raw) To: sup-talk Hi Andrew, > The patch is appended. (This is the first time I've done this with git.) thanks, works perfectly. > That's the next most annying thing for me. Hope to get a chance to work > on it. I had a look at the code and it should not be too hard, basically when a reply buffer is spawned (e.g. thread-view-mode line 168), a hook to call set_sursor_pos 0 (as ThreadViewMode is a subclass of LineCursorMode) after successful sending of the reply should do the job. But unfortunately I don't know too much about the inner workings of sup (can the HookManager be used for this? or should the hook be supplied as attribute to the reply-buffer?), or even Ruby, to do it at the moment. best regards Matthias -- __________________________________________________________ ___ __ __ Dipl. Inf. Matthias Guedemann / __\/ _\ /__\ Computer Systems in Engineering / / \ \ /_\ Otto-von-Guericke Universitaet Magdeburg / /___ _\ \//__ Tel.: 0391 / 67-19359 \____/ \__/\__/ __________________________________________________________ _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [sup-talk] Problems with undo archive and thread focus 2009-11-12 17:30 ` Andrew Pimlott 2009-11-16 9:42 ` Matthias Guedemann @ 2009-11-20 4:51 ` Rich Lane 1 sibling, 0 replies; 4+ messages in thread From: Rich Lane @ 2009-11-20 4:51 UTC (permalink / raw) To: Andrew Pimlott; +Cc: sup-talk Excerpts from Andrew Pimlott's message of Thu Nov 12 12:30:01 -0500 2009: > Excerpts from Matthias Guedemann's message of Thu Nov 05 00:27:25 -0800 2009: > > One is, if you hit 'a' in thread view mode, the thread is archived but undo does > > not work. If you go back to index view and hit 'u' the just archived thread does > > not appear, but the one before. > > I was annoyed by this too and found that undo is minimally implemented. > I added undo to thread view, at least for the cases that I care about or > were easy. I have to say I was discouraged that this was necessary: the > code to archive a thread should all be in one place, and the undo > record should be created there. There's a lot of code duplication, and > I can't tell if it's because the model and view are too coupled, or > because nobody has bothered to factor it out. > > The patch is appended. (This is the first time I've done this with git.) Branch thread-view-mode-undo, merged to master at git://github.com/rlane/sup _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-20 4:51 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-11-05 8:27 [sup-talk] Problems with undo archive and thread focus Matthias Guedemann 2009-11-12 17:30 ` Andrew Pimlott 2009-11-16 9:42 ` Matthias Guedemann 2009-11-20 4:51 ` Rich Lane
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox