mirror of
https://git.zap.org.au/git/trader.git
synced 2025-01-03 14:57:41 -05:00
Change the handling of default value keycodes to be configurable
This commit is contained in:
parent
0a518102ec
commit
8bbee054ad
26
po/en_AU.po
26
po/en_AU.po
@ -14,8 +14,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: trader 7.3\n"
|
||||
"Report-Msgid-Bugs-To: J.Zaitseff@zap.org.au\n"
|
||||
"POT-Creation-Date: 2011-08-30 09:08+1000\n"
|
||||
"PO-Revision-Date: 2011-08-30 08:26+1000\n"
|
||||
"POT-Creation-Date: 2011-08-30 12:38+1000\n"
|
||||
"PO-Revision-Date: 2011-08-30 12:42+1000\n"
|
||||
"Last-Translator: John Zaitseff <J.Zaitseff@zap.org.au>\n"
|
||||
"Language-Team: English (Australian)\n"
|
||||
"Language: en_AU\n"
|
||||
@ -1409,7 +1409,7 @@ msgstr "Page %d of %d"
|
||||
#. TRANSLATORS: The reason the user is not asked "Press any
|
||||
#. key to continue" is historical: many, many people used to
|
||||
#. ask "where is the <ANY> key?" :-)
|
||||
#: src/help.c:473 src/intf.c:3025
|
||||
#: src/help.c:473 src/intf.c:3035
|
||||
msgid "[ Press <SPACE> to continue ] "
|
||||
msgstr "[ Press <SPACE> to continue ] "
|
||||
|
||||
@ -1451,7 +1451,17 @@ msgstr "mkchstr_conv: NUL"
|
||||
msgid "mkchstr: `%s'"
|
||||
msgstr "mkchstr: ‘%s’"
|
||||
|
||||
#: src/intf.c:2025 src/intf.c:2070
|
||||
#. TRANSLATORS: This string specifies the keycodes used to insert the
|
||||
#. default value into the input string, if entered as the very first
|
||||
#. character. Ideally, it should contain an easily-accessible
|
||||
#. keycode that would NOT be used in ordinary input. Digits, ".",
|
||||
#. ",", "+" and "-" are definitely NOT acceptable.
|
||||
#: src/intf.c:2020
|
||||
msgctxt "input|DefaultValue"
|
||||
msgid "=;"
|
||||
msgstr "=;"
|
||||
|
||||
#: src/intf.c:2034 src/intf.c:2079
|
||||
#, c-format
|
||||
msgid "gettxline: illegal character in string: `%ls'"
|
||||
msgstr "gettxline: illegal character in string: ‘%ls’"
|
||||
@ -1460,12 +1470,12 @@ msgstr "gettxline: illegal character in string: ‘%ls’"
|
||||
#. "input|No" contain the keycodes used to determine whether a
|
||||
#. user is answering "Yes" or "No" in response to some question.
|
||||
#. Both upper and lower-case versions should be present.
|
||||
#: src/intf.c:2942
|
||||
#: src/intf.c:2952
|
||||
msgctxt "input|Yes"
|
||||
msgid "Yy"
|
||||
msgstr "Yy"
|
||||
|
||||
#: src/intf.c:2944
|
||||
#: src/intf.c:2954
|
||||
msgctxt "input|No"
|
||||
msgid "Nn"
|
||||
msgstr "Nn"
|
||||
@ -1473,12 +1483,12 @@ msgstr "Nn"
|
||||
#. TRANSLATORS: The strings "Yes" and "No" are printed as a
|
||||
#. response to user input in answer to questions like "Are you
|
||||
#. sure? [Y/N] "
|
||||
#: src/intf.c:2995
|
||||
#: src/intf.c:3005
|
||||
msgctxt "answer"
|
||||
msgid "Yes"
|
||||
msgstr "Yes"
|
||||
|
||||
#: src/intf.c:2997
|
||||
#: src/intf.c:3007
|
||||
msgctxt "answer"
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
26
po/en_CA.po
26
po/en_CA.po
@ -14,8 +14,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: trader 7.3\n"
|
||||
"Report-Msgid-Bugs-To: J.Zaitseff@zap.org.au\n"
|
||||
"POT-Creation-Date: 2011-08-30 09:08+1000\n"
|
||||
"PO-Revision-Date: 2011-08-30 08:26+1000\n"
|
||||
"POT-Creation-Date: 2011-08-30 12:38+1000\n"
|
||||
"PO-Revision-Date: 2011-08-30 12:43+1000\n"
|
||||
"Last-Translator: John Zaitseff <J.Zaitseff@zap.org.au>\n"
|
||||
"Language-Team: English (Canadian)\n"
|
||||
"Language: en_CA\n"
|
||||
@ -1409,7 +1409,7 @@ msgstr "Page %d of %d"
|
||||
#. TRANSLATORS: The reason the user is not asked "Press any
|
||||
#. key to continue" is historical: many, many people used to
|
||||
#. ask "where is the <ANY> key?" :-)
|
||||
#: src/help.c:473 src/intf.c:3025
|
||||
#: src/help.c:473 src/intf.c:3035
|
||||
msgid "[ Press <SPACE> to continue ] "
|
||||
msgstr "[ Press <SPACE> to continue ] "
|
||||
|
||||
@ -1451,7 +1451,17 @@ msgstr "mkchstr_conv: NUL"
|
||||
msgid "mkchstr: `%s'"
|
||||
msgstr "mkchstr: ‘%s’"
|
||||
|
||||
#: src/intf.c:2025 src/intf.c:2070
|
||||
#. TRANSLATORS: This string specifies the keycodes used to insert the
|
||||
#. default value into the input string, if entered as the very first
|
||||
#. character. Ideally, it should contain an easily-accessible
|
||||
#. keycode that would NOT be used in ordinary input. Digits, ".",
|
||||
#. ",", "+" and "-" are definitely NOT acceptable.
|
||||
#: src/intf.c:2020
|
||||
msgctxt "input|DefaultValue"
|
||||
msgid "=;"
|
||||
msgstr "=;"
|
||||
|
||||
#: src/intf.c:2034 src/intf.c:2079
|
||||
#, c-format
|
||||
msgid "gettxline: illegal character in string: `%ls'"
|
||||
msgstr "gettxline: illegal character in string: ‘%ls’"
|
||||
@ -1460,12 +1470,12 @@ msgstr "gettxline: illegal character in string: ‘%ls’"
|
||||
#. "input|No" contain the keycodes used to determine whether a
|
||||
#. user is answering "Yes" or "No" in response to some question.
|
||||
#. Both upper and lower-case versions should be present.
|
||||
#: src/intf.c:2942
|
||||
#: src/intf.c:2952
|
||||
msgctxt "input|Yes"
|
||||
msgid "Yy"
|
||||
msgstr "Yy"
|
||||
|
||||
#: src/intf.c:2944
|
||||
#: src/intf.c:2954
|
||||
msgctxt "input|No"
|
||||
msgid "Nn"
|
||||
msgstr "Nn"
|
||||
@ -1473,12 +1483,12 @@ msgstr "Nn"
|
||||
#. TRANSLATORS: The strings "Yes" and "No" are printed as a
|
||||
#. response to user input in answer to questions like "Are you
|
||||
#. sure? [Y/N] "
|
||||
#: src/intf.c:2995
|
||||
#: src/intf.c:3005
|
||||
msgctxt "answer"
|
||||
msgid "Yes"
|
||||
msgstr "Yes"
|
||||
|
||||
#: src/intf.c:2997
|
||||
#: src/intf.c:3007
|
||||
msgctxt "answer"
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
26
po/en_GB.po
26
po/en_GB.po
@ -14,8 +14,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: trader 7.3\n"
|
||||
"Report-Msgid-Bugs-To: J.Zaitseff@zap.org.au\n"
|
||||
"POT-Creation-Date: 2011-08-30 09:08+1000\n"
|
||||
"PO-Revision-Date: 2011-08-30 08:26+1000\n"
|
||||
"POT-Creation-Date: 2011-08-30 12:38+1000\n"
|
||||
"PO-Revision-Date: 2011-08-30 12:43+1000\n"
|
||||
"Last-Translator: John Zaitseff <J.Zaitseff@zap.org.au>\n"
|
||||
"Language-Team: English (British)\n"
|
||||
"Language: en_GB\n"
|
||||
@ -1409,7 +1409,7 @@ msgstr "Page %d of %d"
|
||||
#. TRANSLATORS: The reason the user is not asked "Press any
|
||||
#. key to continue" is historical: many, many people used to
|
||||
#. ask "where is the <ANY> key?" :-)
|
||||
#: src/help.c:473 src/intf.c:3025
|
||||
#: src/help.c:473 src/intf.c:3035
|
||||
msgid "[ Press <SPACE> to continue ] "
|
||||
msgstr "[ Press <SPACE> to continue ] "
|
||||
|
||||
@ -1451,7 +1451,17 @@ msgstr "mkchstr_conv: NUL"
|
||||
msgid "mkchstr: `%s'"
|
||||
msgstr "mkchstr: ‘%s’"
|
||||
|
||||
#: src/intf.c:2025 src/intf.c:2070
|
||||
#. TRANSLATORS: This string specifies the keycodes used to insert the
|
||||
#. default value into the input string, if entered as the very first
|
||||
#. character. Ideally, it should contain an easily-accessible
|
||||
#. keycode that would NOT be used in ordinary input. Digits, ".",
|
||||
#. ",", "+" and "-" are definitely NOT acceptable.
|
||||
#: src/intf.c:2020
|
||||
msgctxt "input|DefaultValue"
|
||||
msgid "=;"
|
||||
msgstr "=;"
|
||||
|
||||
#: src/intf.c:2034 src/intf.c:2079
|
||||
#, c-format
|
||||
msgid "gettxline: illegal character in string: `%ls'"
|
||||
msgstr "gettxline: illegal character in string: ‘%ls’"
|
||||
@ -1460,12 +1470,12 @@ msgstr "gettxline: illegal character in string: ‘%ls’"
|
||||
#. "input|No" contain the keycodes used to determine whether a
|
||||
#. user is answering "Yes" or "No" in response to some question.
|
||||
#. Both upper and lower-case versions should be present.
|
||||
#: src/intf.c:2942
|
||||
#: src/intf.c:2952
|
||||
msgctxt "input|Yes"
|
||||
msgid "Yy"
|
||||
msgstr "Yy"
|
||||
|
||||
#: src/intf.c:2944
|
||||
#: src/intf.c:2954
|
||||
msgctxt "input|No"
|
||||
msgid "Nn"
|
||||
msgstr "Nn"
|
||||
@ -1473,12 +1483,12 @@ msgstr "Nn"
|
||||
#. TRANSLATORS: The strings "Yes" and "No" are printed as a
|
||||
#. response to user input in answer to questions like "Are you
|
||||
#. sure? [Y/N] "
|
||||
#: src/intf.c:2995
|
||||
#: src/intf.c:3005
|
||||
msgctxt "answer"
|
||||
msgid "Yes"
|
||||
msgstr "Yes"
|
||||
|
||||
#: src/intf.c:2997
|
||||
#: src/intf.c:3007
|
||||
msgctxt "answer"
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
26
po/en_US.po
26
po/en_US.po
@ -14,8 +14,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: trader 7.3\n"
|
||||
"Report-Msgid-Bugs-To: J.Zaitseff@zap.org.au\n"
|
||||
"POT-Creation-Date: 2011-08-30 09:08+1000\n"
|
||||
"PO-Revision-Date: 2011-08-30 08:27+1000\n"
|
||||
"POT-Creation-Date: 2011-08-30 12:38+1000\n"
|
||||
"PO-Revision-Date: 2011-08-30 12:43+1000\n"
|
||||
"Last-Translator: John Zaitseff <J.Zaitseff@zap.org.au>\n"
|
||||
"Language-Team: English\n"
|
||||
"Language: en_US\n"
|
||||
@ -1409,7 +1409,7 @@ msgstr "Page %d of %d"
|
||||
#. TRANSLATORS: The reason the user is not asked "Press any
|
||||
#. key to continue" is historical: many, many people used to
|
||||
#. ask "where is the <ANY> key?" :-)
|
||||
#: src/help.c:473 src/intf.c:3025
|
||||
#: src/help.c:473 src/intf.c:3035
|
||||
msgid "[ Press <SPACE> to continue ] "
|
||||
msgstr "[ Press <SPACE> to continue ] "
|
||||
|
||||
@ -1451,7 +1451,17 @@ msgstr "mkchstr_conv: NUL"
|
||||
msgid "mkchstr: `%s'"
|
||||
msgstr "mkchstr: ‘%s’"
|
||||
|
||||
#: src/intf.c:2025 src/intf.c:2070
|
||||
#. TRANSLATORS: This string specifies the keycodes used to insert the
|
||||
#. default value into the input string, if entered as the very first
|
||||
#. character. Ideally, it should contain an easily-accessible
|
||||
#. keycode that would NOT be used in ordinary input. Digits, ".",
|
||||
#. ",", "+" and "-" are definitely NOT acceptable.
|
||||
#: src/intf.c:2020
|
||||
msgctxt "input|DefaultValue"
|
||||
msgid "=;"
|
||||
msgstr "=;"
|
||||
|
||||
#: src/intf.c:2034 src/intf.c:2079
|
||||
#, c-format
|
||||
msgid "gettxline: illegal character in string: `%ls'"
|
||||
msgstr "gettxline: illegal character in string: ‘%ls’"
|
||||
@ -1460,12 +1470,12 @@ msgstr "gettxline: illegal character in string: ‘%ls’"
|
||||
#. "input|No" contain the keycodes used to determine whether a
|
||||
#. user is answering "Yes" or "No" in response to some question.
|
||||
#. Both upper and lower-case versions should be present.
|
||||
#: src/intf.c:2942
|
||||
#: src/intf.c:2952
|
||||
msgctxt "input|Yes"
|
||||
msgid "Yy"
|
||||
msgstr "Yy"
|
||||
|
||||
#: src/intf.c:2944
|
||||
#: src/intf.c:2954
|
||||
msgctxt "input|No"
|
||||
msgid "Nn"
|
||||
msgstr "Nn"
|
||||
@ -1473,12 +1483,12 @@ msgstr "Nn"
|
||||
#. TRANSLATORS: The strings "Yes" and "No" are printed as a
|
||||
#. response to user input in answer to questions like "Are you
|
||||
#. sure? [Y/N] "
|
||||
#: src/intf.c:2995
|
||||
#: src/intf.c:3005
|
||||
msgctxt "answer"
|
||||
msgid "Yes"
|
||||
msgstr "Yes"
|
||||
|
||||
#: src/intf.c:2997
|
||||
#: src/intf.c:3007
|
||||
msgctxt "answer"
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
14
src/intf.c
14
src/intf.c
@ -1993,6 +1993,7 @@ int gettxline (WINDOW *win, wchar_t *restrict buf, int bufsize,
|
||||
const wchar_t *allowed, bool stripspc, int y, int x,
|
||||
int width, chtype attr)
|
||||
{
|
||||
wchar_t *keycode_defval;
|
||||
bool done, redraw, mod;
|
||||
int len, pos, st;
|
||||
int clen, cpos;
|
||||
@ -2010,6 +2011,14 @@ int gettxline (WINDOW *win, wchar_t *restrict buf, int bufsize,
|
||||
|
||||
chbuf = xmalloc(BUFSIZE * sizeof(chtype));
|
||||
|
||||
keycode_defval = xmalloc(BUFSIZE * sizeof(wchar_t));
|
||||
/* TRANSLATORS: This string specifies the keycodes used to insert the
|
||||
default value into the input string, if entered as the very first
|
||||
character. Ideally, it should contain an easily-accessible
|
||||
keycode that would NOT be used in ordinary input. Digits, ".",
|
||||
",", "+" and "-" are definitely NOT acceptable. */
|
||||
xmbstowcs(keycode_defval, pgettext("input|DefaultValue", "=;"), BUFSIZE);
|
||||
|
||||
keypad(win, true);
|
||||
meta(win, true);
|
||||
wtimeout(win, -1);
|
||||
@ -2055,8 +2064,8 @@ int gettxline (WINDOW *win, wchar_t *restrict buf, int bufsize,
|
||||
if (rcode == OK) {
|
||||
// Ordinary wide character
|
||||
|
||||
if ((key == CHAR_DEFVAL1 || key == CHAR_DEFVAL2)
|
||||
&& defaultval != NULL && len == 0) {
|
||||
if (defaultval != NULL && len == 0
|
||||
&& wcschr(keycode_defval, key) != NULL) {
|
||||
// Initialise buffer with the default value
|
||||
|
||||
wcsncpy(buf, defaultval, bufsize - 1);
|
||||
@ -2705,6 +2714,7 @@ int gettxline (WINDOW *win, wchar_t *restrict buf, int bufsize,
|
||||
}
|
||||
|
||||
free(chbuf);
|
||||
free(keycode_defval);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -101,10 +101,6 @@ typedef enum curs_type {
|
||||
|
||||
#define KEY_CTRL(x) ((x) - 0100) // ASCII control character
|
||||
|
||||
// Keycodes for inserting the default value in input routines
|
||||
#define CHAR_DEFVAL1 L'='
|
||||
#define CHAR_DEFVAL2 L';'
|
||||
|
||||
// Control-arrow key combinations, as returned by Ncurses
|
||||
#ifndef KEY_CDOWN
|
||||
# define KEY_CDOWN 01007 // CTRL + Down Arrow
|
||||
|
Loading…
Reference in New Issue
Block a user