Skip to content

Commit

Permalink
chore(view): remove indent_unit helper fn (helix-editor#4389)
Browse files Browse the repository at this point in the history
  • Loading branch information
matoous authored Oct 20, 2022
1 parent 36f97b6 commit 4cff625
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
6 changes: 3 additions & 3 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3022,7 +3022,7 @@ pub mod insert {
// TODO: round out to nearest indentation level (for example a line with 3 spaces should
// indent by one to reach 4 spaces).

let indent = Tendril::from(doc.indent_unit());
let indent = Tendril::from(doc.indent_style.as_str());
let transaction = Transaction::insert(
doc.text(),
&doc.selection(view.id).clone().cursors(doc.text().slice(..)),
Expand Down Expand Up @@ -3122,7 +3122,7 @@ pub mod insert {
let count = cx.count();
let (view, doc) = current_ref!(cx.editor);
let text = doc.text().slice(..);
let indent_unit = doc.indent_unit();
let indent_unit = doc.indent_style.as_str();
let tab_size = doc.tab_width();
let auto_pairs = doc.auto_pairs(cx.editor);

Expand Down Expand Up @@ -3647,7 +3647,7 @@ fn indent(cx: &mut Context) {
let lines = get_lines(doc, view.id);

// Indent by one level
let indent = Tendril::from(doc.indent_unit().repeat(count));
let indent = Tendril::from(doc.indent_style.as_str().repeat(count));

let transaction = Transaction::change(
doc.text(),
Expand Down
8 changes: 0 additions & 8 deletions helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,14 +1052,6 @@ impl Document {
.map_or(4, |config| config.tab_width) // fallback to 4 columns
}

/// Returns a string containing a single level of indentation.
///
/// TODO: we might not need this function anymore, since the information
/// is conveniently available in `Document::indent_style` now.
pub fn indent_unit(&self) -> &'static str {
self.indent_style.as_str()
}

pub fn changes(&self) -> &ChangeSet {
&self.changes
}
Expand Down

0 comments on commit 4cff625

Please sign in to comment.