popup and diagnose ui
This commit is contained in:
+24
-25
@@ -34,6 +34,30 @@ static int utf8_char_len(const char *s)
|
||||
return 1; // continuation byte or invalid — advance 1 to avoid infinite loop
|
||||
}
|
||||
|
||||
int is_word_char(const char *s)
|
||||
{
|
||||
uint32_t cp = utf8Decode(&s);
|
||||
|
||||
if ((cp >= 'a' && cp <= 'z') || (cp >= 'A' && cp <= 'Z') ||
|
||||
(cp >= '0' && cp <= '9') || cp == '_' || cp == '#')
|
||||
return 1;
|
||||
|
||||
if (cp == 0xFFFD) return 0;
|
||||
|
||||
if (cp >= 0x00C0 && cp <= 0x017F) return 1;
|
||||
if (cp >= 0x0370 && cp <= 0x03FF) return 1;
|
||||
if (cp >= 0x0400 && cp <= 0x04FF) return 1;
|
||||
if (cp >= 0x0600 && cp <= 0x06FF) return 1;
|
||||
if (cp >= 0x05D0 && cp <= 0x05EA) return 1;
|
||||
if (cp >= 0x0900 && cp <= 0x097F) return 1;
|
||||
if (cp >= 0x4E00 && cp <= 0x9FFF) return 1;
|
||||
if ((cp >= 0x3040 && cp <= 0x309F) ||
|
||||
(cp >= 0x30A0 && cp <= 0x30FF)) return 1;
|
||||
if (cp >= 0xAC00 && cp <= 0xD7A3) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Copy one full UTF-8 character from src+i into dst+pos, advance both indices.
|
||||
static void copy_utf8_char(char *dst, int *dst_pos, const char *src, int *src_pos)
|
||||
{
|
||||
@@ -43,31 +67,6 @@ static void copy_utf8_char(char *dst, int *dst_pos, const char *src, int *src_po
|
||||
}
|
||||
|
||||
// Check if character is alphanumeric or underscore
|
||||
int is_word_char(const char *s)
|
||||
{
|
||||
uint32_t cp = utf8Decode(&s);
|
||||
|
||||
if ((cp >= 'a' && cp <= 'z') || (cp >= 'A' && cp <= 'Z') ||
|
||||
(cp >= '0' && cp <= '9') || cp == '_' || cp == '#')
|
||||
return 1;
|
||||
|
||||
if (cp == 0xFFFD) return 0;
|
||||
|
||||
if (cp >= 0x00C0 && cp <= 0x017F) return 1;
|
||||
if (cp >= 0x0370 && cp <= 0x03FF) return 1;
|
||||
if (cp >= 0x0400 && cp <= 0x04FF) return 1;
|
||||
if (cp >= 0x0600 && cp <= 0x06FF) return 1;
|
||||
if (cp >= 0x05D0 && cp <= 0x05EA) return 1;
|
||||
if (cp >= 0x0900 && cp <= 0x097F) return 1;
|
||||
if (cp >= 0x4E00 && cp <= 0x9FFF) return 1;
|
||||
if ((cp >= 0x3040 && cp <= 0x309F) ||
|
||||
(cp >= 0x30A0 && cp <= 0x30FF)) return 1;
|
||||
if (cp >= 0xAC00 && cp <= 0xD7A3) return 1;
|
||||
if ((cp >= 0x0660 && cp <= 0x0669) ||
|
||||
(cp >= 0x06F0 && cp <= 0x06F9)) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check if string is a keyword
|
||||
int is_keyword(const char *word) {
|
||||
|
||||
Reference in New Issue
Block a user