weird behavior of sage in terminal

17 views
Skip to first unread message

Jonathan Bober

unread,
Feb 10, 2012, 5:06:46 AM2/10/12
to sage-...@googlegroups.com
By "sage in terminal" I mean "not the notebook."

In recent builds (maybe mostly in the sage-5.0-beta series, but maybe 4.8, and maybe older -- I know that's not too helpful) I've occasionally noticed weird things working with sage from the command line. Sometimes tab completion has just completely or mostly stopped working until I quit and restart, and now after hitting CTRL-c I have a terminal where the behavior of pressing "up" has just changed.

Normally if I start typing 'G = ', and then hit the up arrow, it will take me to the previous spot where I started a line this way. (I used to _hate_ this behavior, and now I can't live without it.) Now, after hitting CTRL-c in the middle of typing a command (to just erase the whole thing), I find the behavior has changed, so that when I hit up it just takes me to the previous line.

Anyone have any idea what's going on? It's not a big deal, but it seems to be a strange bug, and annoys me sometimes.

Dima Pasechnik

unread,
Feb 10, 2012, 6:38:28 AM2/10/12
to sage-...@googlegroups.com
I have recently noticed this behaviour on MacOSX, especially after resizing the terminal it happens quite a bit.
I end up using CTRL-d to delete a symbol in a line, while normally Delete would work.
(and when I hit Delete it goes to the next sage: prompt, outputting KeyboardInterrupt)

Dima
 

Justin C. Walker

unread,
Feb 10, 2012, 1:58:04 PM2/10/12
to sage-...@googlegroups.com

Normally, this kind of problem is *very* connected to the OS, and terminal emulator, that you are using. The problems you mention deal with "curses/ncurses" library behavior and TERMCAP/TERMINFO databases; and to some extent, with interrupt handling. To some extent, the problems arise from "confused state" in the emulator, which can arise either from a mismatch between kernel and emulator state, or from bugs in either the emulator or terminal description. Sometimes, changing the value of the TERM environment variable can ease the problems (but that takes a lot experimentation and patience).

On Mac OS X/Terminal, you should be able to recover "normal" behavior by doing a full terminal reset (Shell -> Send Hard Reset). Other systems/emulators should have similar functionality.

What system(s) are you using?

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Director
Institute for the Enhancement of the Director's Income
--------
"Weaseling out of things is what separates us from the animals.
Well, except the weasel."
- Homer J Simpson
--------


Jonathan Bober

unread,
Feb 10, 2012, 2:43:29 PM2/10/12
to sage-...@googlegroups.com
On Fri, Feb 10, 2012 at 10:58 AM, Justin C. Walker <jus...@mac.com> wrote:

On 10 Feb, 2012, at 02:06 AM, Jonathan Bober wrote:

> By "sage in terminal" I mean "not the notebook."
>
> In recent builds (maybe mostly in the sage-5.0-beta series, but maybe 4.8, and maybe older -- I know that's not too helpful) I've occasionally noticed weird things working with sage from the command line. Sometimes tab completion has just completely or mostly stopped working until I quit and restart, and now after hitting CTRL-c I have a terminal where the behavior of pressing "up" has just changed.
>
> Normally if I start typing 'G = ', and then hit the up arrow, it will take me to the previous spot where I started a line this way. (I used to _hate_ this behavior, and now I can't live without it.) Now, after hitting CTRL-c in the middle of typing a command (to just erase the whole thing), I find the behavior has changed, so that when I hit up it just takes me to the previous line.
>
> Anyone have any idea what's going on? It's not a big deal, but it seems to be a strange bug, and annoys me sometimes.

Normally, this kind of problem is *very* connected to the OS, and terminal emulator, that you are using.  The problems you mention deal with "curses/ncurses" library behavior and TERMCAP/TERMINFO databases; and to some extent, with interrupt handling.  To some extent, the problems arise from "confused state" in the emulator, which can arise either from a mismatch between kernel and emulator state, or from bugs in either the emulator or terminal description.  Sometimes, changing the value of the TERM environment variable can ease the problems (but that takes a lot experimentation and patience).

On Mac OS X/Terminal, you should be able to recover "normal" behavior by doing a full terminal reset (Shell -> Send Hard Reset).  Other systems/emulators should have similar functionality.

What system(s) are you using?

Justin


Yes, I should have mentioned, of course, that this is on Ubuntu 11.10, 64 bit. I'm using gnome-terminal, and TERM is set to xterm. I didn't think of reset before --- next time something weird happens I'll type '!reset' into Sage, if that is what you mean, and see if that restores things. I can't seem to replicate the behavior right now, though; it really happens only occasionally.

Justin C. Walker

unread,
Feb 10, 2012, 4:23:18 PM2/10/12
to sage-...@googlegroups.com

On 10 Feb, 2012, at 11:43 AM, Jonathan Bober wrote:

>
>
> On Fri, Feb 10, 2012 at 10:58 AM, Justin C. Walker <jus...@mac.com> wrote:
>
> On 10 Feb, 2012, at 02:06 AM, Jonathan Bober wrote:
>
> > By "sage in terminal" I mean "not the notebook."
> >
> > In recent builds (maybe mostly in the sage-5.0-beta series, but maybe 4.8, and maybe older -- I know that's not too helpful) I've occasionally noticed weird things working with sage from the command line. Sometimes tab completion has just completely or mostly stopped working until I quit and restart, and now after hitting CTRL-c I have a terminal where the behavior of pressing "up" has just changed.
> >
> > Normally if I start typing 'G = ', and then hit the up arrow, it will take me to the previous spot where I started a line this way. (I used to _hate_ this behavior, and now I can't live without it.) Now, after hitting CTRL-c in the middle of typing a command (to just erase the whole thing), I find the behavior has changed, so that when I hit up it just takes me to the previous line.
> >
> > Anyone have any idea what's going on? It's not a big deal, but it seems to be a strange bug, and annoys me sometimes.
>
> Normally, this kind of problem is *very* connected to the OS, and terminal emulator, that you are using. The problems you mention deal with "curses/ncurses" library behavior and TERMCAP/TERMINFO databases; and to some extent, with interrupt handling. To some extent, the problems arise from "confused state" in the emulator, which can arise either from a mismatch between kernel and emulator state, or from bugs in either the emulator or terminal description. Sometimes, changing the value of the TERM environment variable can ease the problems (but that takes a lot experimentation and patience).

[snip]


> Yes, I should have mentioned, of course, that this is on Ubuntu 11.10, 64 bit. I'm using gnome-terminal, and TERM is set to xterm. I didn't think of reset before --- next time something weird happens I'll type '!reset' into Sage, if that is what you mean, and see if that restores things. I can't seem to replicate the behavior right now, though; it really happens only occasionally.

That's not what I meant. The 'reset' I referred to is an operation that should be provided by 'xterm'; I've forgotten what series of keys and mouse thingies one has to do to invoke the correct menu, but one of xterm's menus should give you a choice to "reset" the emulator.

HTH

Justin

--
Justin C. Walker, Curmudgeon-At-Large

Institute for the Enhancement of the Director's Income
--------

Experience is what you get
when you don't get what you want.
--------

Reply all
Reply to author
Forward
0 new messages