mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[mujs] accesskey
Not tested.
This commit is contained in:
parent
471d07691e
commit
b34fda3bb1
@ -26,6 +26,7 @@
|
|||||||
#include "ecmascript/mujs/forms.h"
|
#include "ecmascript/mujs/forms.h"
|
||||||
#include "ecmascript/mujs/input.h"
|
#include "ecmascript/mujs/input.h"
|
||||||
#include "ecmascript/mujs/window.h"
|
#include "ecmascript/mujs/window.h"
|
||||||
|
#include "intl/charsets.h"
|
||||||
#include "intl/libintl.h"
|
#include "intl/libintl.h"
|
||||||
#include "main/select.h"
|
#include "main/select.h"
|
||||||
#include "osdep/newwin.h"
|
#include "osdep/newwin.h"
|
||||||
@ -95,7 +96,7 @@ string_get(const JSString *p, int idx)
|
|||||||
static char *
|
static char *
|
||||||
mjs_unicode_to_string(unicode_val_T v)
|
mjs_unicode_to_string(unicode_val_T v)
|
||||||
{
|
{
|
||||||
return "";
|
return encode_utf8(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the string *@vp to an access key. Return 0 for no access
|
/* Convert the string *@vp to an access key. Return 0 for no access
|
||||||
@ -106,34 +107,10 @@ mjs_value_to_accesskey(const char *val)
|
|||||||
#ifdef ECMASCRIPT_DEBUG
|
#ifdef ECMASCRIPT_DEBUG
|
||||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||||
#endif
|
#endif
|
||||||
return UCS_NO_CHAR;
|
const char *end = strchr(val, '\0');
|
||||||
#if 0
|
char *begin = val;
|
||||||
|
|
||||||
|
return utf8_to_unicode(&begin, end);
|
||||||
JSString *p = JS_VALUE_GET_STRING(val);
|
|
||||||
|
|
||||||
size_t len;
|
|
||||||
char16_t chr[2];
|
|
||||||
|
|
||||||
len = p->len;
|
|
||||||
|
|
||||||
/* This implementation ignores extra characters in the string. */
|
|
||||||
if (len < 1)
|
|
||||||
return 0; /* which means no access key */
|
|
||||||
chr[0] = string_get(p, 0);
|
|
||||||
|
|
||||||
if (!is_utf16_surrogate(chr[0])) {
|
|
||||||
return chr[0];
|
|
||||||
}
|
|
||||||
if (len >= 2) {
|
|
||||||
chr[1] = string_get(p, 1);
|
|
||||||
if (is_utf16_high_surrogate(chr[0])
|
|
||||||
&& is_utf16_low_surrogate(chr[1])) {
|
|
||||||
return join_utf16_surrogates(chr[0], chr[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return UCS_NO_CHAR; /* which the caller will reject */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user