aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helix-core/src/indent.rs2
-rw-r--r--helix-core/src/lib.rs2
-rw-r--r--helix-term/src/editor.rs4
-rw-r--r--helix-view/src/commands.rs3
-rw-r--r--helix-view/src/view.rs4
5 files changed, 6 insertions, 9 deletions
diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs
index c1a4fd6c..932eaa24 100644
--- a/helix-core/src/indent.rs
+++ b/helix-core/src/indent.rs
@@ -4,7 +4,7 @@ use crate::{
Rope, RopeSlice, State,
};
-const TAB_WIDTH: usize = 4;
+pub const TAB_WIDTH: usize = 4;
fn indent_level_for_line(line: RopeSlice) -> usize {
let mut len = 0;
diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs
index ccdc7297..62d23a10 100644
--- a/helix-core/src/lib.rs
+++ b/helix-core/src/lib.rs
@@ -1,7 +1,7 @@
#![allow(unused)]
pub mod graphemes;
mod history;
-mod indent;
+pub mod indent;
pub mod macros;
mod position;
pub mod register;
diff --git a/helix-term/src/editor.rs b/helix-term/src/editor.rs
index 60d9e079..134dee50 100644
--- a/helix-term/src/editor.rs
+++ b/helix-term/src/editor.rs
@@ -1,5 +1,5 @@
use clap::ArgMatches as Args;
-use helix_core::{state::Mode, syntax::HighlightEvent, Range, State};
+use helix_core::{indent::TAB_WIDTH, state::Mode, syntax::HighlightEvent, Range, State};
use helix_view::{commands, keymap, View};
use std::{
@@ -24,8 +24,6 @@ use crossterm::{
use tui::{backend::CrosstermBackend, buffer::Buffer as Surface, layout::Rect, style::Style};
-const TAB_WIDTH: usize = 4;
-
type Terminal = tui::Terminal<CrosstermBackend<std::io::Stdout>>;
static EX: smol::Executor = smol::Executor::new();
diff --git a/helix-view/src/commands.rs b/helix-view/src/commands.rs
index d131fbb3..ec22950e 100644
--- a/helix-view/src/commands.rs
+++ b/helix-view/src/commands.rs
@@ -1,5 +1,6 @@
use helix_core::{
graphemes,
+ indent::TAB_WIDTH,
regex::Regex,
register, selection,
state::{Direction, Granularity, Mode, State},
@@ -541,8 +542,6 @@ pub fn paste(view: &mut View, _count: usize) {
}
}
-const TAB_WIDTH: usize = 4;
-
fn get_lines(view: &View) -> Vec<usize> {
let mut lines = Vec::new();
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index 8b677adc..1332f11e 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -5,6 +5,7 @@ use std::{borrow::Cow, path::PathBuf};
use crate::theme::Theme;
use helix_core::{
graphemes::{grapheme_width, RopeGraphemes},
+ indent::TAB_WIDTH,
History, Position, RopeSlice, State,
};
use tui::layout::Rect;
@@ -78,8 +79,7 @@ impl View {
for grapheme in RopeGraphemes::new(&line_slice) {
if grapheme == "\t" {
- // TODO: this should be const TAB_WIDTH
- col += 4;
+ col += TAB_WIDTH;
} else {
let grapheme = Cow::from(grapheme);
col += grapheme_width(&grapheme);