Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Odd key bug
@ 2009-07-27 17:13 Edward Z. Yang
  2009-07-27 17:27 ` Alex Vandiver
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Edward Z. Yang @ 2009-07-27 17:13 UTC (permalink / raw)


After I finish editing a message and exit out of my editor (vim),
if I try to press up arrow in order to move my focus to the
reply mode field to toggle it, I get the errors:

    unknown keypress '^[' for compose-mode
    unknown keypress 'A' for compose-mode

It then works properly.  A guess is something is messing with the
terminal?  This is 100% reproduceable.

Cheers,
Edward


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [sup-talk] Odd key bug
  2009-07-27 17:13 [sup-talk] Odd key bug Edward Z. Yang
@ 2009-07-27 17:27 ` Alex Vandiver
  2009-07-27 17:52   ` Ben Walton
  2009-07-27 17:33 ` William Morgan
  2009-07-27 18:47 ` Tarko Tikan
  2 siblings, 1 reply; 11+ messages in thread
From: Alex Vandiver @ 2009-07-27 17:27 UTC (permalink / raw)


At Mon Jul 27 13:13:01 -0400 2009, Edward Z. Yang wrote:
> After I finish editing a message and exit out of my editor (vim),
> if I try to press up arrow in order to move my focus to the
> reply mode field to toggle it, I get the errors:
> 
>     unknown keypress '^[' for compose-mode
>     unknown keypress 'A' for compose-mode
> 
> It then works properly.  A guess is something is messing with the
> terminal?  This is 100% reproduceable.

As another data point, I also see this, with emacs as my editor.
 - Alex
-- 
Networking -- only one letter away from not working


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [sup-talk] Odd key bug
  2009-07-27 17:13 [sup-talk] Odd key bug Edward Z. Yang
  2009-07-27 17:27 ` Alex Vandiver
@ 2009-07-27 17:33 ` William Morgan
  2009-07-27 18:13   ` Edward Z. Yang
  2009-07-27 18:47 ` Tarko Tikan
  2 siblings, 1 reply; 11+ messages in thread
From: William Morgan @ 2009-07-27 17:33 UTC (permalink / raw)


Reformatted excerpts from Edward Z. Yang's message of 2009-07-27:
> It then works properly.  A guess is something is messing with the
> terminal?  This is 100% reproduceable.

This happens to me too. Maybe there's some more curses weirdness that
needs to happen when shelling out---you can see the current magic spell
at buffer.rb circa line 724, in BufferManager#shell_out. I've just
suffered through it for the past three years.
-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [sup-talk] Odd key bug
  2009-07-27 17:27 ` Alex Vandiver
@ 2009-07-27 17:52   ` Ben Walton
  0 siblings, 0 replies; 11+ messages in thread
From: Ben Walton @ 2009-07-27 17:52 UTC (permalink / raw)


Excerpts from Alex Vandiver's message of Mon Jul 27 13:27:33 -0400 2009:
> As another data point, I also see this, with emacs as my editor.

And I saw it with vim until I switched to emacs a few months back.  I
wonder if this is anything to do with how these curses apps interact
with the 'alternate' screen buffer or something?  For the record, I've
always run sup inside of screen...

I've just been suffering through it too.  Edward, you've given voice
to this insidious little annoyance! :)

-Ben
-- 
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090727/580ec624/attachment.bin>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [sup-talk] Odd key bug
  2009-07-27 17:33 ` William Morgan
@ 2009-07-27 18:13   ` Edward Z. Yang
  2009-07-27 18:30     ` Edward Z. Yang
  0 siblings, 1 reply; 11+ messages in thread
From: Edward Z. Yang @ 2009-07-27 18:13 UTC (permalink / raw)


Excerpts from William Morgan's message of Mon Jul 27 13:33:57 -0400 2009:
> This happens to me too. Maybe there's some more curses weirdness that
> needs to happen when shelling out---you can see the current magic spell
> at buffer.rb circa line 724, in BufferManager#shell_out. I've just
> suffered through it for the past three years.

I tried cargo culting a few extra function calls from the web, to no
avail.  Man, where's an ncurses expert when you need them...

Cheers,
Edward


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [sup-talk] Odd key bug
  2009-07-27 18:13   ` Edward Z. Yang
@ 2009-07-27 18:30     ` Edward Z. Yang
  2009-07-27 19:15       ` Edward Z. Yang
  0 siblings, 1 reply; 11+ messages in thread
From: Edward Z. Yang @ 2009-07-27 18:30 UTC (permalink / raw)


I currently suspect that if I send a null character to the stdscr
(which would require bin/sup to be rewritten a little to make stdscr
globally available) it would serve as a decent workaround.  I don't
actually know how global variables work in Ruby.

(Basically, add stdscr.keypad(0) when we return from the external shell.)

Cheers,
Edward


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [sup-talk] Odd key bug
  2009-07-27 17:13 [sup-talk] Odd key bug Edward Z. Yang
  2009-07-27 17:27 ` Alex Vandiver
  2009-07-27 17:33 ` William Morgan
@ 2009-07-27 18:47 ` Tarko Tikan
  2009-07-27 20:11   ` Andrew Pimlott
  2 siblings, 1 reply; 11+ messages in thread
From: Tarko Tikan @ 2009-07-27 18:47 UTC (permalink / raw)


hey,

> After I finish editing a message and exit out of my editor (vim),
> if I try to press up arrow in order to move my focus to the
> reply mode field to toggle it, I get the errors:

Running sup in screen and seeing it aswell.

As the discussion goes around external editor (and problems switching to and back), I want to throw up an question/idea.

Currently, as the external editor is run, there is no way to switch between sup and external editor (for obvious reasons). Is anyone aware of any better idea how to integrate vim (even better, any editor) into sup and still have the excellent buffer system. Currently, going between received emails, and the one being composed, is a real pain.

Inventing own editor is ofc one solution but it sounds silly to do it from scratch.

-- 
tarko


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [sup-talk] Odd key bug
  2009-07-27 18:30     ` Edward Z. Yang
@ 2009-07-27 19:15       ` Edward Z. Yang
  2009-07-28 15:17         ` William Morgan
  0 siblings, 1 reply; 11+ messages in thread
From: Edward Z. Yang @ 2009-07-27 19:15 UTC (permalink / raw)


Alex Vandiver points out that stdscr is a member variable of Ncurses.
As such, this patch appears to fix the issue.

However, my rationale in my previous message was completely bogus (I
checked the manpage and keypad does NOT send a null key); thus,
I have no fucking clue why this works.  Perhaps forcibly setting this
setting clears some internal buffer.  Either 1 or 0 works, we probably
want 1 since that's what bin/sup sets.

Yay cargo culting! Whoo!

From 61696b6a097a949545db52b4a537d74f8256d807 Mon Sep 17 00:00:00 2001
From: Edward Z. Yang <ezyang at mit.edu>
Date: Mon, 27 Jul 2009 15:03:58 -0400
Subject: [PATCH] Fix broken arrow keypresses after shelling out.

Signed-off-by: Edward Z. Yang <ezyang at mit.edu>
---
 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 8eedf96..5f52d1d 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -723,6 +723,7 @@ EOS
     Ncurses.sync do
       Ncurses.endwin
       system command
+      Ncurses.stdscr.keypad 1
       Ncurses.refresh
       Ncurses.curs_set 0
     end
-- 
1.6.3.3


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [sup-talk] Odd key bug
  2009-07-27 18:47 ` Tarko Tikan
@ 2009-07-27 20:11   ` Andrew Pimlott
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Pimlott @ 2009-07-27 20:11 UTC (permalink / raw)


On Mon, Jul 27, 2009 at 09:47:00PM +0300, Tarko Tikan wrote:
> Currently, as the external editor is run, there is no way to switch between sup and external editor (for obvious reasons). Is anyone aware of any better idea how to integrate vim (even better, any editor) into sup and still have the excellent buffer system.

My idea is to make sup act like a shell and implement job control, so
when you ctrl-z out of your editor, you're back in sup.  You can have
multiple editors stopped in the background, and resume any of them at
any point.

Andrew


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [sup-talk] Odd key bug
  2009-07-27 19:15       ` Edward Z. Yang
@ 2009-07-28 15:17         ` William Morgan
  2009-07-28 15:31           ` Ben Walton
  0 siblings, 1 reply; 11+ messages in thread
From: William Morgan @ 2009-07-28 15:17 UTC (permalink / raw)


Reformatted excerpts from Edward Z. Yang's message of 2009-07-27:
> Alex Vandiver points out that stdscr is a member variable of Ncurses.
> As such, this patch appears to fix the issue.

Applied with great relish direct to master. Thanks!

> I have no fucking clue why this works.  Perhaps forcibly setting this
> setting clears some internal buffer.  Either 1 or 0 works, we probably
> want 1 since that's what bin/sup sets.

Welcome to ncurses programming. Much like fortran, everyone who once
knew what this stuff meant has since died.
-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [sup-talk] Odd key bug
  2009-07-28 15:17         ` William Morgan
@ 2009-07-28 15:31           ` Ben Walton
  0 siblings, 0 replies; 11+ messages in thread
From: Ben Walton @ 2009-07-28 15:31 UTC (permalink / raw)


Excerpts from William Morgan's message of Tue Jul 28 11:17:52 -0400 2009:

> Welcome to ncurses programming. Much like fortran, everyone who once
> knew what this stuff meant has since died.

...or is making a 'mint' maintaining crap^H^H^H^Hcode from the 80's?
<grin>

-Ben
-- 
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090728/7f69db3f/attachment.bin>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-07-28 15:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-27 17:13 [sup-talk] Odd key bug Edward Z. Yang
2009-07-27 17:27 ` Alex Vandiver
2009-07-27 17:52   ` Ben Walton
2009-07-27 17:33 ` William Morgan
2009-07-27 18:13   ` Edward Z. Yang
2009-07-27 18:30     ` Edward Z. Yang
2009-07-27 19:15       ` Edward Z. Yang
2009-07-28 15:17         ` William Morgan
2009-07-28 15:31           ` Ben Walton
2009-07-27 18:47 ` Tarko Tikan
2009-07-27 20:11   ` Andrew Pimlott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox