Add support for hard tabs

* Add a `hard_tabs` setting that causes indentation to be performed
  using a tab instead of multiple spaces.
* Change Buffer's indentation-related APIs to return an `IndentSize`
  struct with a length and a kind, instead of just a single u32.
* Use hard tabs by default in Go.
This commit is contained in:
Max Brunsfeld 2022-06-08 18:08:07 -07:00
parent 129fc515ef
commit f62fd3cddd
8 changed files with 324 additions and 200 deletions

View file

@ -1642,18 +1642,6 @@ impl BufferSnapshot {
.all(|chunk| chunk.matches(|c: char| !c.is_whitespace()).next().is_none())
}
pub fn indent_column_for_line(&self, row: u32) -> u32 {
let mut result = 0;
for c in self.chars_at(Point::new(row, 0)) {
if c == ' ' {
result += 1;
} else {
break;
}
}
result
}
pub fn text_summary_for_range<'a, D, O: ToOffset>(&'a self, range: Range<O>) -> D
where
D: TextDimension,