[comp.sys.mac] control characters in terminal emulation progs

jay@ut-emx.UUCP (Jay Boisseau) (06/29/89)

When I try to type a ctrl-f (forward-one-character), or most any other
ctrl character, everything is OK.  But when I try to type ctrl-@, or any
of the ctrl characters involving a number key or shifted number key, I
get the number entered into my text (whether I used shift or not).  I am
using emacs, and have tried this with both RR 10.3 and VersaTerm 4.0.
For example, to set the mark, the command is ctrl-@ (ctrl-shift-2).  This
works fine on the GraphOn 225 I am currently using, but on my Mac is
enters a '2' into the text, and nothing else.

Any ideas?

Jay Boisseau
jay@emx.utexas.edu

chcu321@ut-emx.UUCP (Michael J. Liebman) (06/30/89)

In article <14666@ut-emx.UUCP> jay@ut-emx.UUCP (Jay Boisseau) writes:
>When I try to type a ctrl-f (forward-one-character), or most any other
>ctrl character, everything is OK.  But when I try to type ctrl-@, or any
>of the ctrl characters involving a number key or shifted number key, I
>get the number entered into my text (whether I used shift or not).  I am
>using emacs, and have tried this with both RR 10.3 and VersaTerm 4.0.
>

 [more stuff deleted]

>Any ideas?
>

Well, if you are using GNU Emacs, you can use C-SPC (control-space) to
set the mark.  IMHO it is easier than C-@, anyway.  

I know this really doesn't answer the question of why these terminal
emulators can't send a C-@, but at least you can set the mark without
doing M-x set-mark :-)



-- 
----------------------------------------------------------------------------

  Michael J. Liebman             INTERNET:
  Dept. of Chemical Engineering    mjl@cheme1.che.utexas.edu (128.83.162.2)
  University of Texas at Austin    chcu321@emx.cc.utexas.edu (128.83.1.33)
   (512) 471-5150.ma.bell        BITNET:
                                   liebman@UTAIVC

----------------------------------------------------------------------------

minow@mountn.dec.com (Martin Minow) (06/30/89)

In article <14666@ut-emx.UUCP> jay@ut-emx.UUCP (Jay Boisseau) discovers
that his terminal emulator doesn't understand ctrl-@.

There really isn't a standard for keyboard->control character processing.
You might try ctrl-space (this works on my emulator because I wrote
it myself).  One problem is that ctrl-@ and/or ctrl-space are probably
sending the <NUL> (000) character, which is often eaten by intervening
hardware/softare.

If you use Emacs, you might find binding set-mark to a function key
offers a longterm solution.

Martin Minow
minow%thundr.dec@decwrl.dec.com

tempest@wet.UUCP (Ken Lui) (07/01/89)

In article <14666@ut-emx.UUCP> jay@ut-emx.UUCP (Jay Boisseau) writes:
>When I try to type a ctrl-f (forward-one-character), or most any other
>ctrl character, everything is OK.  But when I try to type ctrl-@, or any
>of the ctrl characters involving a number key or shifted number key, I
>get the number entered into my text (whether I used shift or not).  I am
>using emacs, and have tried this with both RR 10.3 and VersaTerm 4.0.
>For example, to set the mark, the command is ctrl-@ (ctrl-shift-2).  This
>works fine on the GraphOn 225 I am currently using, but on my Mac is
>enters a '2' into the text, and nothing else.
>

It is a keyboard mapping problem.  I don't know of a way to get a
chr(0) out of the keyboard without using a specific program to do
it.  You can, however, get a Control-^ using the most recent
version of ResEdit.  This is the way I do it:

1.	Open a copy of the System file
2.	Open the KCHR resource.  You should see one labeled "US"
	for domestic units.  Open it; its ID should be 0.
3.	If you press the Control key, if you have an ADB
	keyboard, the keyboard template would change.  You'll
	see valid what the key combinations of Control-A, and
	so on would give you.
	The Table list would change from 0 (default), to 7.  I
	have an SE and am using System 6.0.2.
4.	To change a Control-6 to give you Control-^, select the
	2nd to the last square of the 2nd column from the left
	of the ASCII keys matrix.

	_________________________________________________
	|					Table 	|
	|	ASCII			key-	list	|
	|	keys			board		|
	|	matrix			matrix		|
	|						|
	|						|
	|	Keyboard facsimile			|
	|_______________________________________________|

	Drag the square to where the 6 is on the keyboard
	facsimile.
5.	Quit ResEdit and answer YES when the dialog box comes
	up.

Alternatively, you can create another Table that is used only
when Control-Shift is pressed.  What you need to do is to select
the table that's associated with the Control key by clicking on
it in the Table list.  Go to the KCHR menu and select Duplicate
Table (you won't have to re-enter all those control keys later
on).  Change Control-Shift-6 to reflect its ASCII counterpart.

That's it.

Unfortunately, if you assign ASCII "0" to Control-Shift-2 or
Control-2, pressing it on the Mac keyboard will get you NOTHING!
It really gives you a "NUL" key.  I haven't found any way to get
ASCII "0" to come out by using the KCHR resource.
Another gotcha with this "fix" is that I haven't tried it on a
Mac without a Control key.

I hope this helps a little bit.  If anybody out there in Netland
knows how to get an ASCII "0" from the keyboard by using the KCHR
resource, do tell.

Ken
-- 
_____________________________________________________________________________
     Kenneth K.F. Lui	   |  UUCP:	...{ucsfcca|claris}!wet!tempest
     tempest@wet.UUCP	   |  Internet:	cca.ucsf.edu!wet!tempest@cgl.ucsf.edu
			   |	-or- 	claris!wet!tempest@ames.arc.nasa.gov

cca@pur-phy (Charles C. Allen) (07/02/89)

In article <14666@ut-emx.UUCP>, jay@ut-emx.UUCP (Jay Boisseau) writes:
> When I try to type a ctrl-f (forward-one-character), or most any other
> ctrl character, everything is OK.  But when I try to type ctrl-@, or any
> of the ctrl characters involving a number key or shifted number key, I
> get the number entered into my text (whether I used shift or not).  I am
> using emacs, and have tried this with both RR 10.3 and VersaTerm 4.0.
> For example, to set the mark, the command is ctrl-@ (ctrl-shift-2).  This
> works fine on the GraphOn 225 I am currently using, but on my Mac is
> enters a '2' into the text, and nothing else.

Well, VersaTerm-PRO 3.0.2 handles control-space as ASCII NUL, which is
what control-@ is supposed to emit.  Note that this is a vt100ism.  I
would be really surprised if VersaTerm 4.0 doesn't do the same thing.
The only other "legal" shifted control character I can think of is
control-^, which works fine in VT-PRO.

VT-PRO has a built-in keyboard remapper, so you don't have to fool
around with ResEdit, as others have suggested.

Charles Allen		cca@newton.physics.purdue.edu

craig@sli.com (Craig Woods) (07/05/89)

...In reply to the original question (How to set a mark in emacs, using a Mac
II as a terminal emulator):

Try 'Command (Apple?) - space' rather than Control-@ or Control-Space.  I hit
this by accident once, and sure enough, it set a mark! I don't know if the goat
I sacrificed on the previous sabbath had anything to do with it...

I use NCSA Telnet on a Mac II, which emulates a vt220, and this works for
GNU-Emacs 18.53, and for Gosling Emacs on VMS (don't know the release #)

Hope this helps.

Craig Woods
uunet!sli!craig		FIrst time user, no disclaimer possible.

To: uunet
Subject: Re: control characters in terminal emulation progs
Newsgroups: comp.sys.mac
In-Reply-To: <224@wet.UUCP>
References: <14666@ut-emx.UUCP>
Organization: Software Leverage, Inc. Arlington, MA

...In reply to the original question (How to set a mark in emacs, using a Mac
II as a terminal emulator):

Try 'Command (Apple?) - space' rather than Control-@ or Control-Space.  I hit
this by accident once, and sure enough, it set a mark! I don't know if the goat
I sacrificed on the previous sabbath had anything to do with it...
Also have no clue about ASCII null, or resedit. 

I use NCSA Telnet on a Mac II, which emulates a vt220, and this works for
GNU-Emacs 18.53, and for Gosling Emacs on VMS (don't know the release #)

Hope this helps.

Craig Woods
uunet!sli!craig		FIrst time user, no disclaimer possible.

lih@cunixd.cc.columbia.edu (Andrew Lih) (07/07/89)

In article <1989Jul5.145105.8192@sli.com> craig@sli.UUCP (Craig Woods) writes:
>...In reply to the original question (How to set a mark in emacs, using a Mac
>II as a terminal emulator):
>
>I use NCSA Telnet on a Mac II, which emulates a vt220, and this works for
>GNU-Emacs 18.53, and for Gosling Emacs on VMS (don't know the release #)

On a related note, sometimes when I use NCSA Telnet 2.2, and I use a a
program that uses a lot of screen control characters, I will be popped
into the NCSA VT font, which is totally unreadable, and looks like a
bunch of short choppy lines all over my screen.  It is easy enough to
fix by choosing "Reset Terminal" from the menu item.  I have a hunch
that a special sequence of control characters is toggling this mode.

Here at Columbia we have written a full-screen program that
consistently pops the Mac NCSA Telnet 2.2 into this mode.  We would
like to avoid this, so does anyone know what exact control codes
toggle Telnet into this mode so we can program around it?

Thanks it advance...

/lih

                 ___________________________________________________________
""""""""""     /							    \
|  @  @  |     | Andrew "Fuz" Lih	Columbia University Center           |
<    >   > ___/   Academic Computing	 for Computing Activities            |
 \ \__/ / <___                                                               /
  \____/      \    lih@cunixc.cc.columbia.edu    AJLUS@CUVMB.BITNET         /
	       \    lih@cs.columbia.edu     ...rutgers!columbia!cunixc!lih |
                \__________________________________________________________/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 """""""   Andrew "Fuz" Lih	              Columbia University Center
 | @ @ |   Instructional Computing	      for Computing Activities
 <  ^  >					
  \ - /    lih@cunixc.cc.columbia.edu	      AJLUS@CUVMB.BITNET
   --- 	   lih@heathcliff.cs.columbia.edu  ...rutgers!columbia!cunixc!lih
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=