mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
config: rename "wcswidth" to "legacy" for "grapheme-width-method"
We don't actually use libc wcswidth to determine width and even if we did some terminals use wcwidth (which behaves differently), some use the Python wcswidth library (which behaves differently), etc. The reality is there is no real consistency on "legacy" behavior so by naming it "legacy" we show that we're doing our best but also gives us wiggle room to change our behavior in the future. Functionally nothing changes with this commit.
This commit is contained in:
@ -193,13 +193,14 @@ const c = @cImport({
|
|||||||
///
|
///
|
||||||
/// Valid values are:
|
/// Valid values are:
|
||||||
///
|
///
|
||||||
/// * `wcswidth` - Use the wcswidth function to determine grapheme width.
|
/// * `legacy` - Use a legacy method to determine grapheme width, such as
|
||||||
/// This maximizes compatibility with legacy programs but may result
|
/// wcswidth This maximizes compatibility with legacy programs but may result
|
||||||
/// in incorrect grapheme width for certain graphemes such as skin-tone
|
/// in incorrect grapheme width for certain graphemes such as skin-tone
|
||||||
/// emoji, non-English characters, etc.
|
/// emoji, non-English characters, etc.
|
||||||
///
|
///
|
||||||
/// Note that this `wcswidth` functionality is based on the libc wcswidth,
|
/// This is called "legacy" and not something more specific because the
|
||||||
/// not any other libraries with that name.
|
/// behavior is undefined and we want to retain the ability to modify it.
|
||||||
|
/// For example, we may or may not use libc `wcswidth` now or in the future.
|
||||||
///
|
///
|
||||||
/// * `unicode` - Use the Unicode standard to determine grapheme width.
|
/// * `unicode` - Use the Unicode standard to determine grapheme width.
|
||||||
///
|
///
|
||||||
@ -3464,6 +3465,6 @@ pub const WindowNewTabPosition = enum {
|
|||||||
|
|
||||||
/// See grapheme-width-method
|
/// See grapheme-width-method
|
||||||
pub const GraphemeWidthMethod = enum {
|
pub const GraphemeWidthMethod = enum {
|
||||||
wcswidth,
|
legacy,
|
||||||
unicode,
|
unicode,
|
||||||
};
|
};
|
||||||
|
@ -141,7 +141,7 @@ pub fn init(alloc: Allocator, opts: termio.Options) !Exec {
|
|||||||
// switch to ensure we get a compiler error if more cases are added.
|
// switch to ensure we get a compiler error if more cases are added.
|
||||||
switch (opts.config.grapheme_width_method) {
|
switch (opts.config.grapheme_width_method) {
|
||||||
.unicode => term.modes.set(.grapheme_cluster, true),
|
.unicode => term.modes.set(.grapheme_cluster, true),
|
||||||
.wcswidth => {},
|
.legacy => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the image size limits
|
// Set the image size limits
|
||||||
|
Reference in New Issue
Block a user