...
This commit is contained in:
parent
3e50588525
commit
2aa2607adc
4 changed files with 29 additions and 28 deletions
|
|
@ -115,11 +115,11 @@ Detailed list of changes
|
|||
line (:iss:`8464`)
|
||||
|
||||
- Fix a regression in 0.40.1 that caused copying to clipboard via OSC 52 from
|
||||
applications that dont specify a destination in the escape code not working
|
||||
applications that don't specify a destination in the escape code not working
|
||||
(:iss:`8459`)
|
||||
|
||||
- Wayland: Fix a regression in the previous release that caused crashes on
|
||||
compositors that dont support the xdg-toplevel-icon protocol and the user has
|
||||
compositors that don't support the xdg-toplevel-icon protocol and the user has
|
||||
set a custom kitty icon (:iss:`8471`)
|
||||
|
||||
0.40.1 [2025-03-18]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,30 @@
|
|||
|
||||
#include "data-types.h"
|
||||
|
||||
// CharPropsDeclaration
|
||||
// Uses 23 bits
|
||||
typedef union CharProps {
|
||||
struct {
|
||||
uint8_t shifted_width : 3;
|
||||
uint8_t is_extended_pictographic : 1;
|
||||
uint8_t grapheme_break : 4;
|
||||
uint8_t indic_conjunct_break : 2;
|
||||
uint8_t category : 5;
|
||||
uint8_t is_emoji : 1;
|
||||
uint8_t is_emoji_presentation_base : 1;
|
||||
uint8_t is_invalid : 1;
|
||||
uint8_t is_non_rendered : 1;
|
||||
uint8_t is_symbol : 1;
|
||||
uint8_t is_combining_char : 1;
|
||||
uint8_t is_word_char : 1;
|
||||
uint8_t is_punctuation : 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} CharProps;
|
||||
static_assert(sizeof(CharProps) == sizeof(uint32_t), "Fix the ordering of CharProps");
|
||||
// EndCharPropsDeclaration
|
||||
|
||||
|
||||
// UCBDeclaration
|
||||
typedef enum UnicodeCategory {
|
||||
UC_Cn,
|
||||
|
|
@ -46,29 +70,6 @@ typedef enum UnicodeCategory {
|
|||
// EndUCBDeclaration
|
||||
|
||||
|
||||
// CharPropsDeclaration
|
||||
// Uses 23 bits
|
||||
typedef union CharProps {
|
||||
struct {
|
||||
uint8_t shifted_width : 3;
|
||||
uint8_t is_extended_pictographic : 1;
|
||||
uint8_t grapheme_break : 4;
|
||||
uint8_t indic_conjunct_break : 2;
|
||||
uint8_t category : 5;
|
||||
uint8_t is_emoji : 1;
|
||||
uint8_t is_emoji_presentation_base : 1;
|
||||
uint8_t is_invalid : 1;
|
||||
uint8_t is_non_rendered : 1;
|
||||
uint8_t is_symbol : 1;
|
||||
uint8_t is_combining_char : 1;
|
||||
uint8_t is_word_char : 1;
|
||||
uint8_t is_punctuation : 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} CharProps;
|
||||
static_assert(sizeof(CharProps) == sizeof(uint32_t), "Fix the ordering of CharProps");
|
||||
// EndCharPropsDeclaration
|
||||
|
||||
typedef struct GraphemeSegmentationState {
|
||||
int last_char_prop;
|
||||
|
||||
|
|
|
|||
|
|
@ -638,9 +638,9 @@ py_char_props_for(PyObject *self UNUSED, PyObject *ch) {
|
|||
char_type c = PyUnicode_READ_CHAR(ch, 0);
|
||||
CharProps cp = char_props_for(c);
|
||||
#define B(x) #x, cp.x ? Py_True : Py_False
|
||||
return Py_BuildValue("{ si sO sB sB ss }",
|
||||
return Py_BuildValue("{si sO sB sB ss sO sO}",
|
||||
"width", wcwidth_std(cp), B(is_extended_pictographic), "grapheme_break", cp.grapheme_break,
|
||||
"indic_conjunct_break", cp.indic_conjunct_break, "category", char_category(cp)
|
||||
"indic_conjunct_break", cp.indic_conjunct_break, "category", char_category(cp), B(is_emoji), B(is_emoji_presentation_base)
|
||||
);
|
||||
#undef B
|
||||
}
|
||||
|
|
|
|||
|
|
@ -637,8 +637,8 @@ def test_shlex_split(self):
|
|||
self.ae(expected, actual, f'Failed for text: {q!r}')
|
||||
|
||||
def test_split_into_graphemes(self):
|
||||
self.assertEqual(char_props_for('\ue000')['category'], 'Co')
|
||||
for i, test in enumerate(json.loads(read_kitty_resource('GraphemeBreakTest.json', __name__.rpartition('.')[0]))):
|
||||
expected = test['data']
|
||||
actual = split_into_graphemes(''.join(expected))
|
||||
self.ae(expected, actual, f'Test #{i} failed: {test["comment"]}')
|
||||
self.assertEqual(char_props_for('\ue000')['category'], 'Co')
|
||||
|
|
|
|||
Loading…
Reference in a new issue