zsh-users
 help / color / mirror / code / Atom feed
* mnemonic 'ENTER' with zcurses
@ 2024-01-07 23:54 Ray Andrews
  2024-01-08  0:50 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Ray Andrews @ 2024-01-07 23:54 UTC (permalink / raw)
  To: Zsh Users

This is a pretty trivial matter but 'zcurses input' returns all sorts of 
helpful mnemonics like 'NPAGE', 'DOWN', 'PRESSED1' and so on.  Where are 
these defined?  No likely headers here than I can see.  Closest I can 
find is:

  https://www.man7.org/linux/man-pages/man3/getch.3x.html

... which seems a very similar list.  However that page includes 'ENTER' 
for the predictable thing, but zcurses seems to return no mnemonic for 
that, it's ugly old: " $'\n' ".   Just as a matter of curiosity I'd like 
to know what's going on there.  I'd prefer the mnemonic if it could be had.




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

* Re: mnemonic 'ENTER' with zcurses
  2024-01-07 23:54 mnemonic 'ENTER' with zcurses Ray Andrews
@ 2024-01-08  0:50 ` Bart Schaefer
  2024-01-08  1:08   ` Ray Andrews
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2024-01-08  0:50 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Sun, Jan 7, 2024 at 3:54 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> This is a pretty trivial matter but 'zcurses input' returns all sorts of
> helpful mnemonics like 'NPAGE', 'DOWN', 'PRESSED1' and so on.  Where are
> these defined?

You found the correct manual page, they're defined by the ncurses library.

> However that page includes 'ENTER'
> for the predictable thing, but zcurses seems to return no mnemonic for
> that, it's ugly old: " $'\n' ".

I'm not an expert on this, but I believe in this case ENTER means the
key on the keypad, usually but not always on the outside column
underneath "+" and to the right of "3".  This is not the same as the
key sometimes also called "return" to the right "jkl;'" on a qwerty
board, which does not have a mnemonic in this set.  It's possible
those two keys are mapped to the same thing by your terminal emulator,
which would make curses unable to distinguish them.


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

* Re: mnemonic 'ENTER' with zcurses
  2024-01-08  0:50 ` Bart Schaefer
@ 2024-01-08  1:08   ` Ray Andrews
  2024-01-08  1:34     ` Lawrence Velázquez
  0 siblings, 1 reply; 5+ messages in thread
From: Ray Andrews @ 2024-01-08  1:08 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 541 bytes --]


On 2024-01-07 16:50, Bart Schaefer wrote:

> I'm not an expert on this, but I believe in this case ENTER means the
> key on the keypad,

What we used to call the grey keys.  Yup, that returns ENTER. So they're 
unique here.  Ok then, no mnemonic for '\n' then.  Seems like an 
omission but it is what it is.  Nothing to cry about. Thanks Bart.

I was fooling around in one of my functions seeing if I could capture 
mouse movement, but the doc says no.  Only when a click or a scroll 
event happens is the cursor location reportable.


[-- Attachment #2: Type: text/html, Size: 1052 bytes --]

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

* Re: mnemonic 'ENTER' with zcurses
  2024-01-08  1:08   ` Ray Andrews
@ 2024-01-08  1:34     ` Lawrence Velázquez
  2024-01-08  1:43       ` Ray Andrews
  0 siblings, 1 reply; 5+ messages in thread
From: Lawrence Velázquez @ 2024-01-08  1:34 UTC (permalink / raw)
  To: Ray Andrews; +Cc: zsh-users

On Sun, Jan 7, 2024, at 8:08 PM, Ray Andrews wrote:
> On 2024-01-07 16:50, Bart Schaefer wrote:
>
>> I'm not an expert on this, but I believe in this case ENTER means the key on the keypad, 
> What we used to call the grey keys.  Yup, that returns ENTER. So 
> they're unique here.  Ok then, no mnemonic for '\n' then.  Seems like 
> an omission but it is what it is.

The man page you linked covers this.

	Some keys may be the same as commonly used control keys,
	e.g., KEY_ENTER versus control/M, KEY_BACKSPACE versus
	control/H.  Some curses implementations may differ according
	to whether they treat these control keys specially (and
	ignore the terminfo), or use the terminfo definitions.
	Ncurses uses the terminfo definition.  If it says that
	KEY_ENTER is control/M, getch will return KEY_ENTER when
	you press control/M.

	Generally, KEY_ENTER denotes the character(s) sent by the
	Enter key on the numeric keypad:

	  - the terminal description lists the most useful keys,

	  - the Enter key on the regular keyboard is already handled
	    by the standard ASCII characters for carriage-return
	    and line-feed,

	  - depending on whether nl or nonl was called, pressing
	    "Enter" on the regular keyboard may return either
	    a carriage-return or line-feed, and finally

	  - "Enter or send" is the standard description for this
	    key.

-- 
vq


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

* Re: mnemonic 'ENTER' with zcurses
  2024-01-08  1:34     ` Lawrence Velázquez
@ 2024-01-08  1:43       ` Ray Andrews
  0 siblings, 0 replies; 5+ messages in thread
From: Ray Andrews @ 2024-01-08  1:43 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]


On 2024-01-07 17:34, Lawrence Velázquez wrote:

> The man page you linked covers this.
>
> 	  - depending on whether nl or nonl was called, pressing
> 	    "Enter" on the regular keyboard may return either
> 	    a carriage-return or line-feed, and finally

Sounds like one of those things that's hard to nail down. Different 
keyboards, OS's, and any number of different implementations going back 
to the 60s.  Even that man page -- I have no idea how well it meshes 
with zcurses, only that it seemed close.  '\n' will do fine.


[-- Attachment #2: Type: text/html, Size: 1029 bytes --]

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

end of thread, other threads:[~2024-01-08  1:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-07 23:54 mnemonic 'ENTER' with zcurses Ray Andrews
2024-01-08  0:50 ` Bart Schaefer
2024-01-08  1:08   ` Ray Andrews
2024-01-08  1:34     ` Lawrence Velázquez
2024-01-08  1:43       ` Ray Andrews

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).