summaryrefslogtreecommitdiff
path: root/helix-tui/src/backend/crossterm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-tui/src/backend/crossterm.rs')
-rw-r--r--helix-tui/src/backend/crossterm.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/helix-tui/src/backend/crossterm.rs b/helix-tui/src/backend/crossterm.rs
index fba1f029..4b230f53 100644
--- a/helix-tui/src/backend/crossterm.rs
+++ b/helix-tui/src/backend/crossterm.rs
@@ -14,7 +14,10 @@ use crossterm::{
terminal::{self, Clear, ClearType},
Command,
};
-use helix_view::graphics::{Color, CursorKind, Modifier, Rect, UnderlineStyle};
+use helix_view::{
+ editor::Config as EditorConfig,
+ graphics::{Color, CursorKind, Modifier, Rect, UnderlineStyle},
+};
use once_cell::sync::OnceCell;
use std::{
fmt,
@@ -39,14 +42,15 @@ impl Capabilities {
/// Detect capabilities from the terminfo database located based
/// on the $TERM environment variable. If detection fails, returns
/// a default value where no capability is supported.
- pub fn from_env_or_default() -> Self {
+ pub fn from_env_or_default(config: &EditorConfig) -> Self {
match termini::TermInfo::from_env() {
Err(_) => Capabilities::default(),
Ok(t) => Capabilities {
// Smulx, VTE: https://unix.stackexchange.com/a/696253/246284
// Su (used by kitty): https://sw.kovidgoyal.net/kitty/underlines
// WezTerm supports underlines but a lot of distros don't properly install it's terminfo
- has_extended_underlines: t.extended_cap("Smulx").is_some()
+ has_extended_underlines: config.undercurl
+ || t.extended_cap("Smulx").is_some()
|| t.extended_cap("Su").is_some()
|| vte_version() >= Some(5102)
|| matches!(term_program().as_deref(), Some("WezTerm")),
@@ -65,10 +69,10 @@ impl<W> CrosstermBackend<W>
where
W: Write,
{
- pub fn new(buffer: W) -> CrosstermBackend<W> {
+ pub fn new(buffer: W, config: &EditorConfig) -> CrosstermBackend<W> {
CrosstermBackend {
buffer,
- capabilities: Capabilities::from_env_or_default(),
+ capabilities: Capabilities::from_env_or_default(config),
supports_keyboard_enhancement_protocol: OnceCell::new(),
}
}