aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/document.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 11a0dbf8..bbcc8666 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -1122,13 +1122,18 @@ impl Document {
self.syntax.as_ref()
}
- /// Tab size in columns.
+ /// The width that the tab character is rendered at
pub fn tab_width(&self) -> usize {
self.language_config()
.and_then(|config| config.indent.as_ref())
.map_or(4, |config| config.tab_width) // fallback to 4 columns
}
+ // The width (in spaces) of a level of indentation.
+ pub fn indent_width(&self) -> usize {
+ self.indent_style.indent_width(self.tab_width())
+ }
+
pub fn changes(&self) -> &ChangeSet {
&self.changes
}