I use this line in my ~/.mailcap to view HTML attachements in Mutt: text/html; w3m -dump -T text/html %s | pager; needsterminal; description=HTML Text; nametemplate=%s.html which doesn''t work with Sup. The attached patch fix this by not redirecting stderr to /dev/null. It also restores the correct ncurses state (including arrow keypresses, thanks to Edward Z. Yang recent patch). -- A: Because it destroys the flow of conversation. Q: Why is top posting dumb? -------------- next part -------------- A non-text attachment was scrubbed... Name: sup-run-mailcap.patch Type: application/octet-stream Size: 704 bytes Desc: not available URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090802/1fa7b4f6/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090802/1fa7b4f6/attachment.bin>
Hi Beno?t, Reformatted excerpts from Beno?t PIERRE''s message of 2009-08-02:> The attached patch fix this by not redirecting stderr to /dev/null. > It also restores the correct ncurses state (including arrow > keypresses, thanks to Edward Z. Yang recent patch).Thanks! Not redirecting stderr to /dev/null is probably fine. But how about calling BufferManager.shell_out instead? If you want to submit a proper git commit via git-format-email, I will be happy to apply it and you can get your name in the illustrious Sup contributor roster. Otherwise I will make this change for you. -- William <wmorgan-sup at masanjin.net>
Benoît PIERRE
2009-Aug-11 22:09 UTC
[sup-talk] [PATCH run-mailcap 1/2] Don''t redirect stderr to /dev/null when calling run-mailcap.
Some programs will fail to work correctly if this is done, like for
example: w3m --dump, to view HTML files.
---
lib/sup/message-chunks.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index 0d742d9..4c947e1 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -131,7 +131,7 @@ EOS
def initial_state; :open end
def viewable?; @lines.nil? end
def view_default! path
- cmd = "/usr/bin/run-mailcap --action=view
''#{@content_type}:#{path}'' 2>/dev/null"
+ cmd = "/usr/bin/run-mailcap --action=view
''#{@content_type}:#{path}''"
Redwood::log "running: #{cmd.inspect}"
system cmd
$? == 0
--
1.6.3.3
Benoît PIERRE
2009-Aug-11 22:09 UTC
[sup-talk] [PATCH run-mailcap 2/2] Use BufferManager.shell_out to call run-mailcap instead of system.
This ensure ncurses state is correctly restored upon command completion.
---
lib/sup/message-chunks.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index 4c947e1..1910abd 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -133,7 +133,7 @@ EOS
def view_default! path
cmd = "/usr/bin/run-mailcap --action=view
''#{@content_type}:#{path}''"
Redwood::log "running: #{cmd.inspect}"
- system cmd
+ BufferManager.shell_out(cmd)
$? == 0
end
--
1.6.3.3
William Morgan
2009-Aug-14 20:17 UTC
[sup-talk] [PATCH run-mailcap 2/2] Use BufferManager.shell_out to call run-mailcap instead of system.
Reformatted excerpts from Beno?t PIERRE''s message of 2009-08-11:> This ensure ncurses state is correctly restored upon command completion.Both patches applies to branch run-mailcap-fixes, merged into next. Thanks! -- William <wmorgan-sup at masanjin.net>
Benoît PIERRE
2009-Aug-14 22:37 UTC
[sup-talk] [PATCH run-mailcap 2/2] Use BufferManager.shell_out to call run-mailcap instead of system.
Excerpts from William Morgan''s message of Fri Aug 14 22:17:38 +0200 2009:> Reformatted excerpts from Beno?t PIERRE''s message of 2009-08-11: > > This ensure ncurses state is correctly restored upon command completion. > > Both patches applies to branch run-mailcap-fixes, merged into next.Great! One problem though, I tested next, and 3478e400ae31b459b2875cc226796a6d4bba11f9 (rewrap getch in select, handle sigwinch manually) introduced a regression: I get some ''key not handled'' errors after run-mail has been called when sup is getting back control if I press for example an arrow... ;( Arrows become usable again after I press a "normal" key (like ''a''). Cheers, -- A: Because it destroys the flow of conversation. Q: Why is top posting dumb?
Benoît PIERRE
2009-Aug-14 23:08 UTC
[sup-talk] [PATCH] Restore keypad mode after we force ncurses to refresh the whole screen.
This also happen to fix a regression after a call to run-mailcap, since
for some reason a screen resize event is triggered when we get control
back...
---
lib/sup/buffer.rb | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index b3a256f..09281e9 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -270,6 +270,7 @@ EOS
## this magic makes Ncurses get the new size of the screen
Ncurses.endwin
+ Ncurses.stdscr.keypad 1
Ncurses.refresh
@sigwinch_mutex.synchronize { @sigwinch_happened = false }
Redwood::log "new screen size is #{Ncurses.rows} x
#{Ncurses.cols}"
--
1.6.3.3
--
A: Because it destroys the flow of conversation.
Q: Why is top posting dumb?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL:
<http://rubyforge.org/pipermail/sup-talk/attachments/20090815/a67dfe70/attachment.bin>
William Morgan
2009-Aug-16 22:00 UTC
[sup-talk] [PATCH] Restore keypad mode after we force ncurses to refresh the whole screen.
Reformatted excerpts from Beno?t PIERRE''s message of 2009-08-14:> This also happen to fix a regression after a call to run-mailcap, > since for some reason a screen resize event is triggered when we get > control back...Applied to ncurses-fixes, merged into next. Thanks! -- William <wmorgan-sup at masanjin.net>