From c00fc41abadbbe0e838f7f8ba9901478df1825f9 Mon Sep 17 00:00:00 2001 From: Joshua Reusch Date: Tue, 1 Oct 2024 18:51:33 +0200 Subject: [PATCH] mode_wcwidth just for docs --- src/string_width.gleam | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/string_width.gleam b/src/string_width.gleam index 3c06d67..e1471a1 100644 --- a/src/string_width.gleam +++ b/src/string_width.gleam @@ -82,6 +82,17 @@ pub fn mode_2027_ext(options: Options) -> Options { Options(..options, mode: Mode2027Ext) } +/// The default mode and the mode suitable for most terminals. +/// +/// Measures individual code points, similar to the libc `wcwidth` function +/// that almost all of these terminals use. +/// +/// Note that except for `fold_raw`, this library will still always process +/// grapheme clusters as a unit. +pub fn mode_wcwidth(options: Options) -> Options { + Options(..options, mode: ModeWcwidth) +} + /// Some characters are marked by Unicode as "ambiguous", meaning they may /// occupy 1 or 2 cells, depending on the context, current language, selected /// font, surrounding text, and more. -- 2.51.2