summaryrefslogtreecommitdiff
path: root/helix-view/src/view.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-22 04:47:39 +0000
committerBlaž Hrastnik2021-03-22 04:53:36 +0000
commit5e6716c89c0909bc374e26bedbba703427f9aa26 (patch)
tree658163e26962c436d0406f8dcf0d5f900116efdc /helix-view/src/view.rs
parent698e4ddea46e9c94d537c8e4a6c69e7dc9ee1947 (diff)
Add tab_width and indent_unit config.
Diffstat (limited to 'helix-view/src/view.rs')
-rw-r--r--helix-view/src/view.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index b406b756..31a36047 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -5,7 +5,6 @@ use std::borrow::Cow;
use crate::Document;
use helix_core::{
graphemes::{grapheme_width, RopeGraphemes},
- indent::TAB_WIDTH,
Position, RopeSlice,
};
use slotmap::DefaultKey as Key;
@@ -72,10 +71,11 @@ impl View {
let line_start = text.line_to_char(line);
let line_slice = text.slice(line_start..pos);
let mut col = 0;
+ let tab_width = self.doc.tab_width();
for grapheme in RopeGraphemes::new(line_slice) {
if grapheme == "\t" {
- col += TAB_WIDTH;
+ col += tab_width;
} else {
let grapheme = Cow::from(grapheme);
col += grapheme_width(&grapheme);