Improve bidi handling in entry editor.
This commit is contained in:
parent
4542e71b8b
commit
34f71cb866
8 changed files with 453 additions and 267 deletions
|
@ -77,6 +77,14 @@ grub_print_ucs4 (const grub_uint32_t * str,
|
|||
const grub_uint32_t * last_position,
|
||||
int margin_left, int margin_right,
|
||||
struct grub_term_output *term);
|
||||
|
||||
void
|
||||
grub_print_ucs4_menu (const grub_uint32_t * str,
|
||||
const grub_uint32_t * last_position,
|
||||
int margin_left, int margin_right,
|
||||
struct grub_term_output *term,
|
||||
int skip_lines, int max_lines, grub_uint32_t contchar,
|
||||
struct grub_term_pos *pos);
|
||||
int
|
||||
grub_ucs4_count_lines (const grub_uint32_t * str,
|
||||
const grub_uint32_t * last_position,
|
||||
|
|
|
@ -104,7 +104,7 @@ grub_term_color_state;
|
|||
#define GRUB_TERM_CODE_TYPE_CP437 (1 << GRUB_TERM_CODE_TYPE_SHIFT)
|
||||
/* UTF-8 stream in logical order. Usually used for terminals
|
||||
which just forward the stream to another computer. */
|
||||
#define GRUB_TERM_CODE_TYPE_UTF8_LOGICAL (2 << GRUB_TERM_CODE_TYPE_SHIFT)
|
||||
#define GRUB_TERM_CODE_TYPE_UTF8_LOGICAL (2 << GRUB_TERM_CODE_TYPE_SHIFT)
|
||||
/* UTF-8 in visual order. Like UTF-8 logical but for buggy endpoints. */
|
||||
#define GRUB_TERM_CODE_TYPE_UTF8_VISUAL (3 << GRUB_TERM_CODE_TYPE_SHIFT)
|
||||
/* Glyph description in visual order. */
|
||||
|
@ -344,7 +344,7 @@ static inline unsigned grub_term_height (struct grub_term_output *term)
|
|||
static inline unsigned
|
||||
grub_term_border_width (struct grub_term_output *term)
|
||||
{
|
||||
return grub_term_width (term) - GRUB_TERM_MARGIN * 3 - GRUB_TERM_SCROLL_WIDTH;
|
||||
return grub_term_width (term) - GRUB_TERM_MARGIN * 2;
|
||||
}
|
||||
|
||||
/* The max column number of an entry. The last "-1" is for a
|
||||
|
@ -352,7 +352,7 @@ grub_term_border_width (struct grub_term_output *term)
|
|||
static inline int
|
||||
grub_term_entry_width (struct grub_term_output *term)
|
||||
{
|
||||
return grub_term_border_width (term) - 2 - GRUB_TERM_MARGIN * 2 - 1;
|
||||
return grub_term_border_width (term) - GRUB_TERM_MARGIN * 2 - 1;
|
||||
}
|
||||
|
||||
static inline grub_uint16_t
|
||||
|
|
|
@ -139,6 +139,7 @@ struct grub_unicode_glyph
|
|||
grub_uint16_t variant:9;
|
||||
grub_uint8_t attributes:5;
|
||||
grub_size_t ncomb;
|
||||
grub_size_t orig_pos;
|
||||
struct grub_unicode_combining {
|
||||
grub_uint32_t code;
|
||||
enum grub_comb_type type;
|
||||
|
@ -186,6 +187,13 @@ enum
|
|||
GRUB_UNICODE_THAANA_SUKUN = 0x07b0,
|
||||
GRUB_UNICODE_ZWNJ = 0x200c,
|
||||
GRUB_UNICODE_ZWJ = 0x200d,
|
||||
GRUB_UNICODE_LRM = 0x200e,
|
||||
GRUB_UNICODE_RLM = 0x200f,
|
||||
GRUB_UNICODE_LRE = 0x202a,
|
||||
GRUB_UNICODE_RLE = 0x202b,
|
||||
GRUB_UNICODE_PDF = 0x202c,
|
||||
GRUB_UNICODE_LRO = 0x202d,
|
||||
GRUB_UNICODE_RLO = 0x202e,
|
||||
GRUB_UNICODE_LEFTARROW = 0x2190,
|
||||
GRUB_UNICODE_UPARROW = 0x2191,
|
||||
GRUB_UNICODE_RIGHTARROW = 0x2192,
|
||||
|
@ -222,13 +230,21 @@ extern struct grub_unicode_bidi_pair grub_unicode_bidi_pairs[];
|
|||
/* Unicode mandates an arbitrary limit. */
|
||||
#define GRUB_BIDI_MAX_EXPLICIT_LEVEL 61
|
||||
|
||||
struct grub_term_pos
|
||||
{
|
||||
unsigned valid:1;
|
||||
unsigned x:15, y:16;
|
||||
};
|
||||
|
||||
grub_ssize_t
|
||||
grub_bidi_logical_to_visual (const grub_uint32_t *logical,
|
||||
grub_size_t logical_len,
|
||||
struct grub_unicode_glyph **visual_out,
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
|
||||
grub_size_t max_width,
|
||||
grub_size_t start_width);
|
||||
grub_size_t start_width, grub_uint32_t codechar,
|
||||
struct grub_term_pos *pos,
|
||||
int primitive_wrap);
|
||||
|
||||
enum grub_comb_type
|
||||
grub_unicode_get_comb_type (grub_uint32_t c);
|
||||
|
@ -275,4 +291,8 @@ grub_unicode_mirror_code (grub_uint32_t in);
|
|||
grub_uint32_t
|
||||
grub_unicode_shape_code (grub_uint32_t in, grub_uint8_t attr);
|
||||
|
||||
const grub_uint32_t *
|
||||
grub_unicode_get_comb_end (const grub_uint32_t *end,
|
||||
const grub_uint32_t *cur);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue