Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support terminal-wg's BiDi draft proposal in alacritty_terminal #7872

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MoSal
Copy link
Contributor

@MoSal MoSal commented Mar 27, 2024

https://terminal-wg.pages.freedesktop.org/bidi

Implementation is hidden behind a bidi_draft crate feature, and depends on alacritty/vte#112.

Public API is limited to:

  • Cell::bidi_mode() method which returns a BidiMode enum value.
  • Cell::bidi_box_mirroring() method which returns a boolean.
  • Term boolean field bidi_disable_arrow_key_swapping.

Cell BidiFlags is only used internally since relations/interactions between individual flags are not straight forward, and could lead to erroneous behavior if it's all left for API consumers to figure out.

BidiDir named fields exist in all BidiMode variants. This is done deliberately (instead of e.g. a BidiMode struct with a BidiDir field) to signify the different purpose BidiDir serves in each mode.

@MoSal MoSal marked this pull request as draft March 27, 2024 20:03
@chrisduerr
Copy link
Member

@perfbot

@perfbot
Copy link

perfbot commented Mar 27, 2024

results

@chrisduerr
Copy link
Member

Seems like there's no performance impact, it's possible that the u8 fits inside the existing cell's padding though I'm too lazy to do the math. That said I still think it would be better stored in the extra data if this ever goes anywhere.

@MoSal
Copy link
Contributor Author

MoSal commented Mar 28, 2024

Seems like there's no performance impact, it's possible that the u8 fits inside the existing cell's padding though I'm too lazy to do the math. That said I still think it would be better stored in the extra data if this ever goes anywhere.

Yeah, I benched no_bidi, bidi_cell, and bidi_extra, and the difference was in the noise.

Does perfbot bench with --all-features though? If not, then results above only benched the SCP change!


I will add some tests next. Is anything else required of me?

@chrisduerr
Copy link
Member

Does perfbot bench with --all-features though? If not, then results above only benched the SCP change!

It does not, good point. I've temporarily enabled it as a default feature for testing.

@chrisduerr
Copy link
Member

@perfbot

@perfbot
Copy link

perfbot commented Mar 29, 2024

results

@@ -2082,6 +2193,15 @@ impl<T: EventListener> Handler for Term<T> {
let mode = match mode {
ansi::Mode::Named(mode) => mode,
ansi::Mode::Unknown(mode) => {
#[cfg(feature = "bidi_draft")]
// BDSM
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BI-DIRECTIONAL SUPPORT MODE

https://terminal-wg.pages.freedesktop.org/bidi

Implementation is hidden behind a `bidi_draft` crate feature, and
depends on alacritty/vte#112.

Public API is limited to:
 * `Cell::bidi_mode()` method which returns a `BidiMode` enum value.
 * `Cell::bidi_box_mirroring()` method which returns a boolean.
 * `Term` boolean field `bidi_disable_arrow_key_swapping`.

Cell `BidiFlags` is only used internally since relations/interactions
between individual flags are not straight forward, and could lead to
erroneous behavior if it's all left for API consumers to figure out.

`BidiDir` named fields exist in all `BidiMode` variants. This is done
deliberately (instead of e.g. a `BidiMode` struct with a `BidiDir` field)
to signify the different purpose `BidiDir` serves in each mode.

Signed-off-by: Mohammad AlSaleh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants