config: rename at-most-2 (value for grapheme-width-method) to double-width

This commit is contained in:
Daniel Eklöf 2021-07-01 08:00:23 +02:00
parent 9817e44c32
commit 5138f02214
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 10 additions and 10 deletions

View file

@ -36,7 +36,7 @@
terminfo entries. This should make 24-bit RGB colors work in tmux and terminfo entries. This should make 24-bit RGB colors work in tmux and
neovim, without the need for config hacks or detection heuristics neovim, without the need for config hacks or detection heuristics
(https://codeberg.org/dnkl/foot/issues/615). (https://codeberg.org/dnkl/foot/issues/615).
* `[tweak].grapheme-width-method=wcswidth|at-most-2` option to * `[tweak].grapheme-width-method=wcswidth|double-width` option to
`foot.ini`. `foot.ini`.

View file

@ -2256,8 +2256,8 @@ parse_section_tweak(
} }
else if (strcmp(key, "grapheme-width-method") == 0) { else if (strcmp(key, "grapheme-width-method") == 0) {
if (strcmp(value, "at-most-2") == 0) if (strcmp(value, "double-width") == 0)
conf->tweak.grapheme_width_method = GRAPHEME_WIDTH_MAX_2; conf->tweak.grapheme_width_method = GRAPHEME_WIDTH_DOUBLE;
else if (strcmp(value, "wcswidth") == 0) else if (strcmp(value, "wcswidth") == 0)
conf->tweak.grapheme_width_method = GRAPHEME_WIDTH_WCSWIDTH; conf->tweak.grapheme_width_method = GRAPHEME_WIDTH_WCSWIDTH;
@ -2832,7 +2832,7 @@ config_load(struct config *conf, const char *conf_path,
.fcft_filter = FCFT_SCALING_FILTER_LANCZOS3, .fcft_filter = FCFT_SCALING_FILTER_LANCZOS3,
.allow_overflowing_double_width_glyphs = true, .allow_overflowing_double_width_glyphs = true,
.grapheme_shaping = false, .grapheme_shaping = false,
.grapheme_width_method = GRAPHEME_WIDTH_MAX_2, .grapheme_width_method = GRAPHEME_WIDTH_DOUBLE,
.delayed_render_lower_ns = 500000, /* 0.5ms */ .delayed_render_lower_ns = 500000, /* 0.5ms */
.delayed_render_upper_ns = 16666666 / 2, /* half a frame period (60Hz) */ .delayed_render_upper_ns = 16666666 / 2, /* half a frame period (60Hz) */
.max_shm_pool_size = 512 * 1024 * 1024, .max_shm_pool_size = 512 * 1024 * 1024,

View file

@ -246,7 +246,7 @@ struct config {
enum fcft_scaling_filter fcft_filter; enum fcft_scaling_filter fcft_filter;
bool allow_overflowing_double_width_glyphs; bool allow_overflowing_double_width_glyphs;
bool grapheme_shaping; bool grapheme_shaping;
enum {GRAPHEME_WIDTH_WCSWIDTH, GRAPHEME_WIDTH_MAX_2} grapheme_width_method; enum {GRAPHEME_WIDTH_WCSWIDTH, GRAPHEME_WIDTH_DOUBLE} grapheme_width_method;
bool render_timer_osd; bool render_timer_osd;
bool render_timer_log; bool render_timer_log;
bool damage_whole_window; bool damage_whole_window;

View file

@ -1003,19 +1003,19 @@ any of these options.
*grapheme-width-method* *grapheme-width-method*
Selects which method to use when calculating the width Selects which method to use when calculating the width
(i.e. number of columns) of a grapheme cluster. One of *at-most-2* (i.e. number of columns) of a grapheme cluster. One of
and *wcswidth*. *double-width* and *wcswidth*.
*wcswidth* simply adds together the individual width of all *wcswidth* simply adds together the individual width of all
codepoints making up the cluster. codepoints making up the cluster.
*at-most-2* does the same, but limits the maximum number of *double-width* does the same, but limits the maximum number of
columns to 2. This is more correct, but is likely to break columns to 2. This is more correct, but is likely to break
applications since applications typically use *wcswidth*(3) applications since applications typically use *wcswidth*(3)
internally to calculate the width. This results in cursor internally to calculate the width. This results in cursor
de-synchronization issues. de-synchronization issues.
Default: _at-most-2_ Default: _double-width_
*max-shm-pool-size-mb* *max-shm-pool-size-mb*
This option controls the amount of virtual address space used by This option controls the amount of virtual address space used by

2
vt.c
View file

@ -768,7 +768,7 @@ action_utf8_print(struct terminal *term, wchar_t wc)
composed != NULL ? composed->width : base_width; composed != NULL ? composed->width : base_width;
switch (term->conf->tweak.grapheme_width_method) { switch (term->conf->tweak.grapheme_width_method) {
case GRAPHEME_WIDTH_MAX_2: case GRAPHEME_WIDTH_DOUBLE:
if (unlikely(wc == 0xfe0f)) if (unlikely(wc == 0xfe0f))
width = 2; width = 2;
new_cc->width = min(grapheme_width + width, 2); new_cc->width = min(grapheme_width + width, 2);