iraf-community / x11iraf

X11/GUI utilities and applications for IRAF (xgterm, ximtool, xtapemon)
https://iraf-community.github.io/x11iraf
21 stars 8 forks source link

give xgterm access to tty #48

Open jeromeorosz opened 2 years ago

jeromeorosz commented 2 years ago

Hi All,

I have a brand new MacBook Pro 16 inch with the Apple M1 Max chip. It is running OS 12.1. After some fussing, I managed to build IRAF (thanks for the effort!), and install the X11 tools. xmtool launches, and I was able to display an image and use imexamine.

However, there is one minor annoyance. When I start xgterm, I get this:

Warning: no access to the tty (Undefined error: 0)

The practical effect is that I cannot use the backspace key, nor do the arrow keys seem to work like they used to on the previous laptop (which ran OS 10.15 if memory serves). Is there a way to fix this?

Thanks,

Jerry Orosz

jeromeorosz commented 2 years ago

Correction: OS 12.2.1, just did a software update Monday.

olebole commented 2 years ago

I can reproduce this on macOS 11.6.3, but only for the tcsh prompt. After starting IRAF (ecl), everything works for me. Since tcsh is quite outdated and IRAF is the only use case, I think it does not make much sense to put efforts in fixing this (but I would ofcourse happily accept a bugfix!) I would recommend to limit the use of xgterm to IRAF, or switch to another shell, like bash or zsh.

jeromeorosz commented 2 years ago

Thanks for the response! Here was my previous alias I was using, which resulted in the tty error:

iraf: aliased to /Users/jorosz/x11iraf-2.1/xgterm/xgterm -ls -sb -j -bg white -fg black -e cl &

I changed it to this, and I have the backspace key and the file completion working:

iraf: aliased to /Users/jorosz/x11iraf-2.1/xgterm/xgterm -ls -sb -j -bg white -fg black -e ecl &

One remaining annoyance: When I use the up arrow to go to a previous command, sometimes the prompt does not seem to refresh. For example, let's say I used two commands:

ecl> pwd ecl> cd TESS

The up arrow will sometimes result in something like this:

ecl> cdTESSpwd

If I hit enter here, the 'pwd' command is executed. It is as if the last line of the xgterm is not refreshing properly. I get the same behavior if I launch all of this from the tcsh, or from a bash shell.

In any event, the file completion (right arrow) and the backspace were huge for me, and they seem to work now, so thanks again for the response.

olebole commented 2 years ago

Yes, "cl" is the old shell without command line editing, while "ecl" is the new one. For the problem with the display of older lines, I have no idea.

phartigan commented 1 year ago

Hi, just found this useful thread. Am having the same behavior with 2.17 on an older Mac laptop running Mojave and bash. I found the up-arrow and down-arrow keys in the ecl work as long as the commands in the buffer are 4 characters or less. Gave it a try with some nonsense commands: aaaa bbbb cccc

and the up and down arrow keys work and I can edit. But try aaaaa bbbbb ccccc

and now use the up-arrow and I get the following prompts: ecl> ccccc ecl> cccccbbbbb ecl> cccccbbbbbaaaaa

the same behavior as jeromeorosz reports. Running ecl from the xterm does not show this problem. So the problem is the combination of ecl and xgterm. So the behavior for the arrow keys (and ^U to erase lines) is

xterm alone : works xterm + ecl : works (IRAF, but no graphics) xgterm alone : works xgterm + ecl : fail

If I do a 'stty -a' in both I find only 3 differences: echok, igpar, and iutf8. I changed the xgterm to match those in the xterm, but it did not fix anything. BTW, I launched the xgterm from the xterm, hoping it would inherit some keys. I can use the 'e' command within ecl to move up and down with the arrow keys, but then the delete key doesn't work anymore to modify commands so the 'e' key is pretty useless.

This is one of those small things that makes quite a difference in ease of usage. Anyone with more termcap expertise than me have any ideas? I can't follow what ecl is doing in its code.

Pat Hartigan

phartigan commented 1 year ago

FWIW, Ctrl-L clears the window and refreshes the prompt. A keymap of up-arrow = up-arrow+Ctrl-L would probably make this work, but I don't know how to map that in login.cl. Some xmodmap wizardry perhaps.

Junjie-Jin commented 1 year ago

Maybe you can solve this problem by restart the XQuartz.