@@ -14,7 +14,10 @@ use crossterm::{
1414 terminal::{self, Clear, ClearType},
1515 Command,
1616};
17−use helix_view::graphics::{Color, CursorKind, Modifier, Rect, UnderlineStyle};
17+use helix_view::{
18+ editor::Config as EditorConfig,
19+ graphics::{Color, CursorKind, Modifier, Rect, UnderlineStyle},
20+};
1821use once_cell::sync::OnceCell;
1922use std::{
2023 fmt,
@@ -39,14 +42,15 @@ impl Capabilities {
3942 /// Detect capabilities from the terminfo database located based
4043 /// on the $TERM environment variable. If detection fails, returns
4144 /// a default value where no capability is supported.
42− pub fn from_env_or_default() -> Self {
45+ pub fn from_env_or_default(config: &EditorConfig) -> Self {
4346 match termini::TermInfo::from_env() {
4447 Err(_) => Capabilities::default(),
4548 Ok(t) => Capabilities {
4649 // Smulx, VTE: https://unix.stackexchange.com/a/696253/246284
4750 // Su (used by kitty): https://sw.kovidgoyal.net/kitty/underlines
4851 // WezTerm supports underlines but a lot of distros don't properly install it's terminfo
49− has_extended_underlines: t.extended_cap("Smulx").is_some()
52+ has_extended_underlines: config.undercurl
53+ || t.extended_cap("Smulx").is_some()
5054 || t.extended_cap("Su").is_some()
5155 || vte_version() >= Some(5102)
5256 || matches!(term_program().as_deref(), Some("WezTerm")),
@@ -65,10 +69,10 @@ impl<W> CrosstermBackend<W>
6569where
6670 W: Write,
6771{
68− pub fn new(buffer: W) -> CrosstermBackend<W> {
72+ pub fn new(buffer: W, config: &EditorConfig) -> CrosstermBackend<W> {
6973 CrosstermBackend {
7074 buffer,
71− capabilities: Capabilities::from_env_or_default(),
75+ capabilities: Capabilities::from_env_or_default(config),
7276 supports_keyboard_enhancement_protocol: OnceCell::new(),
7377 }
7478 }