aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-10-14 03:01:41 +0000
committerBlaž Hrastnik2020-10-14 04:35:54 +0000
commitd64f4beede412dbf77df0e00c478b053a3d6cc54 (patch)
treed665023a2b6ead07a65487bbeb2bcd34e1f44ea3 /helix-view
parent0b74d423d017b8b201cf9a471f8c1fb1e96de148 (diff)
Share tab width definitions.
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/commands.rs3
-rw-r--r--helix-view/src/view.rs4
2 files changed, 3 insertions, 4 deletions
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);