mirror of https://github.com/helix-editor/helix
If set to 'true' this option will force terminal undercurl support.pull/6311/head
parent
3e03a1a99b
commit
d479adfdc6
|
@ -53,6 +53,7 @@ signal to the Helix process on Unix operating systems, such as by using the comm
|
||||||
| `completion-replace` | Set to `true` to make completions always replace the entire word and not just the part before the cursor | `false` |
|
| `completion-replace` | Set to `true` to make completions always replace the entire word and not just the part before the cursor | `false` |
|
||||||
| `auto-info` | Whether to display info boxes | `true` |
|
| `auto-info` | Whether to display info boxes | `true` |
|
||||||
| `true-color` | Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative | `false` |
|
| `true-color` | Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative | `false` |
|
||||||
|
| `undercurl` | Set to `true` to override automatic detection of terminal undercurl support in the event of a false negative | `false` |
|
||||||
| `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file | `[]` |
|
| `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file | `[]` |
|
||||||
| `bufferline` | Renders a line at the top of the editor displaying open buffers. Can be `always`, `never` or `multiple` (only shown if more than one buffer is in use) | `never` |
|
| `bufferline` | Renders a line at the top of the editor displaying open buffers. Can be `always`, `never` or `multiple` (only shown if more than one buffer is in use) | `never` |
|
||||||
| `color-modes` | Whether to color the mode indicator with different colors depending on the mode itself | `false` |
|
| `color-modes` | Whether to color the mode indicator with different colors depending on the mode itself | `false` |
|
||||||
|
|
|
@ -134,7 +134,7 @@ impl Application {
|
||||||
let syn_loader = std::sync::Arc::new(syntax::Loader::new(syn_loader_conf));
|
let syn_loader = std::sync::Arc::new(syntax::Loader::new(syn_loader_conf));
|
||||||
|
|
||||||
#[cfg(not(feature = "integration"))]
|
#[cfg(not(feature = "integration"))]
|
||||||
let backend = CrosstermBackend::new(stdout());
|
let backend = CrosstermBackend::new(stdout(), &config.editor);
|
||||||
|
|
||||||
#[cfg(feature = "integration")]
|
#[cfg(feature = "integration")]
|
||||||
let backend = TestBackend::new(120, 150);
|
let backend = TestBackend::new(120, 150);
|
||||||
|
|
|
@ -14,7 +14,10 @@ use crossterm::{
|
||||||
terminal::{self, Clear, ClearType},
|
terminal::{self, Clear, ClearType},
|
||||||
Command,
|
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 once_cell::sync::OnceCell;
|
||||||
use std::{
|
use std::{
|
||||||
fmt,
|
fmt,
|
||||||
|
@ -39,14 +42,15 @@ impl Capabilities {
|
||||||
/// Detect capabilities from the terminfo database located based
|
/// Detect capabilities from the terminfo database located based
|
||||||
/// on the $TERM environment variable. If detection fails, returns
|
/// on the $TERM environment variable. If detection fails, returns
|
||||||
/// a default value where no capability is supported.
|
/// 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() {
|
match termini::TermInfo::from_env() {
|
||||||
Err(_) => Capabilities::default(),
|
Err(_) => Capabilities::default(),
|
||||||
Ok(t) => Capabilities {
|
Ok(t) => Capabilities {
|
||||||
// Smulx, VTE: https://unix.stackexchange.com/a/696253/246284
|
// Smulx, VTE: https://unix.stackexchange.com/a/696253/246284
|
||||||
// Su (used by kitty): https://sw.kovidgoyal.net/kitty/underlines
|
// 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
|
// 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()
|
|| t.extended_cap("Su").is_some()
|
||||||
|| vte_version() >= Some(5102)
|
|| vte_version() >= Some(5102)
|
||||||
|| matches!(term_program().as_deref(), Some("WezTerm")),
|
|| matches!(term_program().as_deref(), Some("WezTerm")),
|
||||||
|
@ -65,10 +69,10 @@ impl<W> CrosstermBackend<W>
|
||||||
where
|
where
|
||||||
W: Write,
|
W: Write,
|
||||||
{
|
{
|
||||||
pub fn new(buffer: W) -> CrosstermBackend<W> {
|
pub fn new(buffer: W, config: &EditorConfig) -> CrosstermBackend<W> {
|
||||||
CrosstermBackend {
|
CrosstermBackend {
|
||||||
buffer,
|
buffer,
|
||||||
capabilities: Capabilities::from_env_or_default(),
|
capabilities: Capabilities::from_env_or_default(config),
|
||||||
supports_keyboard_enhancement_protocol: OnceCell::new(),
|
supports_keyboard_enhancement_protocol: OnceCell::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,12 @@
|
||||||
//! use std::io;
|
//! use std::io;
|
||||||
//! use helix_tui::Terminal;
|
//! use helix_tui::Terminal;
|
||||||
//! use helix_tui::backend::CrosstermBackend;
|
//! use helix_tui::backend::CrosstermBackend;
|
||||||
|
//! use helix_view::editor::Config;
|
||||||
//!
|
//!
|
||||||
//! fn main() -> Result<(), io::Error> {
|
//! fn main() -> Result<(), io::Error> {
|
||||||
//! let stdout = io::stdout();
|
//! let stdout = io::stdout();
|
||||||
//! let backend = CrosstermBackend::new(stdout);
|
//! let config = Config::default();
|
||||||
|
//! let backend = CrosstermBackend::new(stdout, &config);
|
||||||
//! let mut terminal = Terminal::new(backend)?;
|
//! let mut terminal = Terminal::new(backend)?;
|
||||||
//! Ok(())
|
//! Ok(())
|
||||||
//! }
|
//! }
|
||||||
|
@ -56,11 +58,13 @@
|
||||||
//! use helix_tui::backend::CrosstermBackend;
|
//! use helix_tui::backend::CrosstermBackend;
|
||||||
//! use helix_tui::widgets::{Widget, Block, Borders};
|
//! use helix_tui::widgets::{Widget, Block, Borders};
|
||||||
//! use helix_tui::layout::{Layout, Constraint, Direction};
|
//! use helix_tui::layout::{Layout, Constraint, Direction};
|
||||||
|
//! use helix_view::editor::Config;
|
||||||
//!
|
//!
|
||||||
//! fn main() -> Result<(), io::Error> {
|
//! fn main() -> Result<(), io::Error> {
|
||||||
//! terminal::enable_raw_mode().unwrap();
|
//! terminal::enable_raw_mode().unwrap();
|
||||||
//! let stdout = io::stdout();
|
//! let stdout = io::stdout();
|
||||||
//! let backend = CrosstermBackend::new(stdout);
|
//! let config = Config::default();
|
||||||
|
//! let backend = CrosstermBackend::new(stdout, &config);
|
||||||
//! let mut terminal = Terminal::new(backend)?;
|
//! let mut terminal = Terminal::new(backend)?;
|
||||||
//! // terminal.draw(|f| {
|
//! // terminal.draw(|f| {
|
||||||
//! // let size = f.size();
|
//! // let size = f.size();
|
||||||
|
@ -86,11 +90,13 @@
|
||||||
//! use helix_tui::backend::CrosstermBackend;
|
//! use helix_tui::backend::CrosstermBackend;
|
||||||
//! use helix_tui::widgets::{Widget, Block, Borders};
|
//! use helix_tui::widgets::{Widget, Block, Borders};
|
||||||
//! use helix_tui::layout::{Layout, Constraint, Direction};
|
//! use helix_tui::layout::{Layout, Constraint, Direction};
|
||||||
|
//! use helix_view::editor::Config;
|
||||||
//!
|
//!
|
||||||
//! fn main() -> Result<(), io::Error> {
|
//! fn main() -> Result<(), io::Error> {
|
||||||
//! terminal::enable_raw_mode().unwrap();
|
//! terminal::enable_raw_mode().unwrap();
|
||||||
//! let stdout = io::stdout();
|
//! let stdout = io::stdout();
|
||||||
//! let backend = CrosstermBackend::new(stdout);
|
//! let config = Config::default();
|
||||||
|
//! let backend = CrosstermBackend::new(stdout, &config);
|
||||||
//! let mut terminal = Terminal::new(backend)?;
|
//! let mut terminal = Terminal::new(backend)?;
|
||||||
//! // terminal.draw(|f| {
|
//! // terminal.draw(|f| {
|
||||||
//! // let chunks = Layout::default()
|
//! // let chunks = Layout::default()
|
||||||
|
|
|
@ -263,6 +263,8 @@ pub struct Config {
|
||||||
pub cursor_shape: CursorShapeConfig,
|
pub cursor_shape: CursorShapeConfig,
|
||||||
/// Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative. Defaults to `false`.
|
/// Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative. Defaults to `false`.
|
||||||
pub true_color: bool,
|
pub true_color: bool,
|
||||||
|
/// Set to `true` to override automatic detection of terminal undercurl support in the event of a false negative. Defaults to `false`.
|
||||||
|
pub undercurl: bool,
|
||||||
/// Search configuration.
|
/// Search configuration.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub search: SearchConfig,
|
pub search: SearchConfig,
|
||||||
|
@ -737,6 +739,7 @@ impl Default for Config {
|
||||||
statusline: StatusLineConfig::default(),
|
statusline: StatusLineConfig::default(),
|
||||||
cursor_shape: CursorShapeConfig::default(),
|
cursor_shape: CursorShapeConfig::default(),
|
||||||
true_color: false,
|
true_color: false,
|
||||||
|
undercurl: false,
|
||||||
search: SearchConfig::default(),
|
search: SearchConfig::default(),
|
||||||
lsp: LspConfig::default(),
|
lsp: LspConfig::default(),
|
||||||
terminal: get_terminal_provider(),
|
terminal: get_terminal_provider(),
|
||||||
|
|
Loading…
Reference in New Issue