On Sun, Oct 29, 2006 at 11:30:45AM +1030, Malcolm Kay wrote:

> On Sat, 28 Oct 2006 12:27 pm, Noah wrote:
> > well I am pressing control-J for return not control-M so I
> > dont understand your rationale.
> >
> 
> There seems to be considerable confusion in this thread between 
> keystrokes and the codes they produce.
> 
> Most modern keyboards report some form of scan code for each key 
> pressed whether or not it is one of the modifier or special 
> keys. At this stage there is no connection between the key or
> key combination pressed and an ASCII code.

The original post talked about the characters in a text file - most
particularly the ^M and I responded to that and not to anything about 
keyboard codes.   Generally, regardless of what scan codes the machine 
generates with keypresses, a text editor still puts certain codes in 
the text file, essentially according to the ASCII character set.   Now 
a wordprocessor file or a WYSIWYG or a GUI system uses a much more 
extended set of character codes and representations and action codes.
But, that wasn't the orginal post topic.

////jerry

> 
> What an application sees in terms of codes depends on the OS and 
> anything else that may get in between. We mostly think of keys 
> and key combinations as being connected to the the codes seen by
> an ordinary console application, but this can vary according to 
> the OS.
> 
> With a standard setup running X applications with a graphics 
> interface are able to see all keys translated to some form of 
> symbol code (some sort of a super set of ASCII including codes
> for special keys) which can be customised with xmodmap.
>  
> Character mode programs under X through some terminal emulation
> window will see codes (usually ASCII) as further translated by
> that terminal emulator. I find that by default xterm reports ^M
> on pressing the "enter/return" key but this can further 
> customised through XTerm or .Xdefaults. A basic key is generally
> combined with the currently active modifier keys(shift,ctrl,alt,
> etc) to produce the code reported to the application. Other keys 
> such as function keys might be reported as a sequence of codes.
> 
> Utilities and applications may manage codes differently when they 
> recognise the source as the keyboard so for example Ctrl-J, 
> Ctrl-M and "enter" from the keyboard are all reported by "cat" 
> as ^J.
> 
> Malcolm
> 
> 
> > Jerry McAllister wrote:
> > >> Thanks Peter,
> > >>
> > >> where is the logic here?  What is control-q for and what is
> > >> control-j for?  I am trying to figure out how I could have
> > >> figured that out.
> > >
> > > They are ASCII characters.   For example, the ^M you wanted
> > > to get rid of is CTRL-M.    There are ASCII tables in
> > > various places. A quick search should turn up a few.   The
> > > assignment of the characters are ancient and traditional and
> > > somewhat weird by how things are currently used, but will
> > > probably continue to stay that way.
> > >
> > > Line-Feed, for example - which is that character that marks
> > > the end of a line in text files, means it causes the printer
> > > to move the paper up one line - in old line printers and
> > > teletypes.  CTRL-M or ^M is a RETURN (also ENTER nowdays)
> > > and that caused the print head to return to the beginning of
> > > the line.  By the time UNIX came along, it wasn't necessary
> > > to use both characters to move the paper and print head
> > > because those were virtual.  So, they just used one
> > > character - the line feed.   But, MS-DOS and some others
> > > continued to use the pair to mean a new line for some reason
> > > - maybe the original association with IBM, although they
> > > didn't use ASCII, but EBCDIC - another animal.
> > >
> > > So, look up an ASCII chart with explanations and you can
> > > make an educated guess on the meanings.
> > >
> > > ////jerry
> > >
> > >> also is there a better page than the one I am using below
> > >> to figure all these keystrokes out?
> > >>
> > >> http://www.math.uh.edu/~bgb/emacs_keys.html
> > >>
> > >> Cheers,
> > >>
> > >> Noah
> > >>
> > >> Peter A. Giessel wrote:
> > >>> On 2006/10/27 15:20, Noah seems to have typed:
> > >>>> this is the best answer.  Hits it right on the head of
> > >>>> what I want. What if I want the character to replace the
> > >>>> ^M with a new line what do I enter in the replace field?
> > >>>
> > >>> control-q control-j
> > >>
> > >> _______________________________________________
> > >> freebsd-questions@freebsd.org mailing list
> > >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > >> To unsubscribe, send any mail to
> > >> "[EMAIL PROTECTED]"
> >
> > _______________________________________________
> > freebsd-questions@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to
> > "[EMAIL PROTECTED]"
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to