Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Variants

Reply
 
Thread Tools Display Modes
Old January 21, 2022, 22:03   #1
smbhax
Adept
 
Join Date: Oct 2021
Location: WA
Posts: 211
smbhax is on a distinguished road
Code fix for the "slow ESC" key input in old variants?

Old variants such as Hellband and Zangband process ESC key input only after a momentary delay, at least in Curses mode; the "tilde" key just below ESC does the same thing, but operates immediately.

Is there a general code fix for the slow ESC key input in these variants?
__________________
My roguelike gameplay videos

Last edited by smbhax; January 22, 2022 at 02:11.
smbhax is offline   Reply With Quote
Old January 22, 2022, 12:49   #2
Gwarl
Knight
 
Join Date: Jan 2017
Posts: 919
Gwarl will become famous soon enough
seems like it was fixed some time between vanilla 3.2.0 and vanilla 3.4.1. I daren't check 3.3.0 right now
Gwarl is offline   Reply With Quote
Old January 22, 2022, 13:35   #3
wobbly
Prophet
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,578
wobbly will become famous soon enough
If its the same problem oangband has I get round it by macro-ing the escape key to the escape key. Don't know why that works, just seems to.
wobbly is offline   Reply With Quote
Old January 22, 2022, 18:47   #4
smbhax
Adept
 
Join Date: Oct 2021
Location: WA
Posts: 211
smbhax is on a distinguished road
Quote:
Originally Posted by Gwarl View Post
seems like it was fixed some time between vanilla 3.2.0 and vanilla 3.4.1. I daren't check 3.3.0 right now
Intriguing!

Quote:
Originally Posted by wobbly View Post
If its the same problem oangband has I get round it by macro-ing the escape key to the escape key. Don't know why that works, just seems to.
Oh that's interesting. I tried doing some kind of ESC/tilde keymap in Zangband but couldn't seem to get it to take, same with an ESC-ESC one. I don't know my way around macros very well, though.
__________________
My roguelike gameplay videos
smbhax is offline   Reply With Quote
Old January 23, 2022, 03:29   #5
smbhax
Adept
 
Join Date: Oct 2021
Location: WA
Posts: 211
smbhax is on a distinguished road
Current Angband has a section in src/main-gcu.c starting with this disclaimer

Code:
	/* This might be a bad idea, but...
	 *
	 * Here we try to second-guess ncurses. In some cases, keypad() mode will
	 * fail to translate multi-byte escape sequences into things like number-
	 * pad actions, function keys, etc. So we can hardcode a small list of some
	 * of the most common sequences here, just in case.
and including

Code:
		case 27:        i = ESCAPE; break;
and similar statements for arrow keys, keypad keys, etc. Zangband's src/main-gcu.c has no analogous section as far as I can tell. Perhaps this section has something to do with it?

Angband's also has
Code:
	/* We do it like this to prevent a link error with curseses that
	 * lack ESCDELAY. */
	if (!getenv("ESCDELAY")) {
#if _POSIX_C_SOURCE < 200112L
		static char escdelbuf[80] = "ESCDELAY=20";
		putenv(escdelbuf);
#else
		setenv("ESCDELAY", "20", 1);
#endif
	}
which looked tantalizing, but just dropping it in Zangband did not magically cure the sluggish ESC key. ;; )
__________________
My roguelike gameplay videos

Last edited by smbhax; January 23, 2022 at 04:20.
smbhax is offline   Reply With Quote
Old January 23, 2022, 09:58   #6
smbhax
Adept
 
Join Date: Oct 2021
Location: WA
Posts: 211
smbhax is on a distinguished road
Quote:
Originally Posted by Gwarl View Post
seems like it was fixed some time between vanilla 3.2.0 and vanilla 3.4.1. I daren't check 3.3.0 right now
I went to try out the releases in this range but for all of them got "multiple definitions" compile errors concerning z-file.h or z-term.h, so I have been of no use.
__________________
My roguelike gameplay videos
smbhax is offline   Reply With Quote
Old January 23, 2022, 10:03   #7
smbhax
Adept
 
Join Date: Oct 2021
Location: WA
Posts: 211
smbhax is on a distinguished road
In build notes, the only thing that jumped out at me--not that I know that I'm looking for--is that 3.4.0 included "Upgrade to UTF-8."

Oh and "Fix GCU port to recognise backspace and del as distinct keys."
__________________
My roguelike gameplay videos
smbhax is offline   Reply With Quote
Old February 1, 2022, 01:32   #8
smbhax
Adept
 
Join Date: Oct 2021
Location: WA
Posts: 211
smbhax is on a distinguished road
Modern ESC key support was added to Angband by stefanor@cox.net on January 22, 2009 in https://github.com/angband/angband/c...f76cc30dcb9bc5

Their description of that commit is

Quote:
* Make pseudo graphics the default for main-gcu, as they are for the other ports.
* Changed the default macros to use the new pre-processed keys, thus mostly eliminating the "escape delay" and being more portable.
* Implement support for the curses "alternate character set", used for pseudographics e.g. by nethack 'DECgraphics'. The high bit of characters is repurposed for this, hopefully the Eastern Europe community won't mind.
* We now use curses to parse keys, which does a much better job than the old "abuse of macro system". More portable and significantly faster, especially for Escape.
* Unprintable characters are blotted with ?s, removing another irritating display glitch from the visual editor.
It DOES include that "ESCDELAY" section in main-gcu.c.

It went out in Angband 3.1.1, 26th July 2009, noted specifically as

Quote:
Use curses to parse keys, which is more portable and removes the Escape delay
under the heading "Curses port."

For an example of how it was incorporated into a variant that had forked from an earlier version of Angband: PosChengband incorporated it on February 25, 2015 as "Curses Port: Fix unacceptable delay on ESC keypress" https://github.com/NickMcConnell/pos...6af5a176ec0661, with changes to main-gcu.c, util.c, and externs.h; there were also changes to Makefile, main.c, and z-config.h in that commit, but those may have been incidental.
__________________
My roguelike gameplay videos

Last edited by smbhax; February 1, 2022 at 01:46.
smbhax is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
roguelike keyset targeting mode: "k" key (up) only works in uppercase "K" yendor Vanilla 2 October 6, 2021 02:31
Bug: "n" not counted as a non-"ESC" key chikinn Vanilla 3 November 8, 2014 22:34
Bug with "Turn" in the "Player History" dump bron Vanilla 3 January 17, 2014 16:35
(Hopefully) useful code snippet modifies "]" command to highlight unidentified items Max Stats Vanilla 31 January 11, 2011 21:12
"repeat" Command just little bit "smarter" ClaytonAguiar Vanilla 8 June 17, 2009 15:01


All times are GMT +1. The time now is 03:32.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.