1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 05:12:40 +03:00
wezterm/bidi
Wez Furlong 98f35bbf24 bidi: tag Line with bidi mode
This commit refines bidi property handling:

* experimental_bidi has been split into two new configuration settings;
  `bidi_enabled` (which controls whether the terminal performs implicit
  bidi processing) and `bidi_direction` which specifies the base
  direction and whether auto detection is enabled.
* The `Line` type can now store those bidi properties (they are actually
  split across 3 bits representing enabled, auto-detection and
  direction)
* The terminal now has a concept of active bidi properties and default
  bidi properties
* The default properties are pulled from the wezterm configuration
* active bidi properties are potentially set via escape sequences,
  BDSM (which sets bidi_enabled) and SCP (which sets bidi_direction).
  We don't support the 2501 temporary dec private mode suggested by
  the BIDI recommendation doc at this time.
* When creating new `Line`'s or clearing from the start of a `Line`, the
  effective bidi properties are computed (from the active props,
  falling back to default propr) and applied to the `Line`.
* When rendering the line, we now look at its bidi properties instead
  of just the global config.

The default bidi properties are `bidi_enabled: false` and
`bidi_direction: LeftToRight` which corresponds to the typical
bidi-unaware mode of most terminals.

It is possible to live reload the config to change the effective
defaults, but note that they apply, by design, to new lines being
processed through the terminal.  That means existing output is
left unaffected by a config reload, but subsequently printed lines
will respect it.  Pressing CTRL-L or otherwise contriving to have
the running application refresh its display should cause the
refreshed display to update and apply the new bidi mode.

refs: #784
2022-01-30 09:50:04 -07:00
..
data Add wezterm-bidi crate 2022-01-24 19:29:03 -07:00
examples wezterm: add experimental_bidi config option and very basic bidi 2022-01-25 09:00:53 -07:00
generate Add wezterm-bidi crate 2022-01-24 19:29:03 -07:00
src bidi: tag Line with bidi mode 2022-01-30 09:50:04 -07:00
Cargo.toml bidi: tag Line with bidi mode 2022-01-30 09:50:04 -07:00
LICENSE.md Add wezterm-bidi crate 2022-01-24 19:29:03 -07:00
README.md Add wezterm-bidi crate 2022-01-24 19:29:03 -07:00

wezterm-bidi - a pure Rust bidi implementation

This crate provides an implementation of the The Unicode Bidirectional Algorithm (UBA) in Rust.

This crate was developed for use in wezterm but does not depend on other code in wezterm.

The focus for this crate is conformance.

Status

This crate resolves embedding levels and can reorder line ranges.

The implementation conformant with 100% of the BidiTest.txt and BidiCharacterTest.txt test cases (approx 780,000 test cases).

License

MIT compatible License Copyright © 2022-Present Wez Furlong.

Portions of the code in this crate were derived from the bidiref reference implementation of the UBA which is:

Copyright © 1991-2022 Unicode, Inc. All rights reserved.

See LICENSE.md for the full text of the license.