on master help sign in
chore(view): remove indent_unit helper fn (#4389)
commit4cff6250548d279ab69627177bd55312adb822a6 authorMatouš Dzivjak <matousdzivjak@gmail.com> dateFri 21 Oct 2022, 00:05 (4 years ago) parent36f97b6
2 files changed+3−11
helix-term/src/commands.rs+3−3 helix-view/src/document.rs−8
helix-term/src/commands.rs+3−3
@@ -3022,7 +3022,7 @@ pub mod insert {
30223022 // TODO: round out to nearest indentation level (for example a line with 3 spaces should
30233023 // indent by one to reach 4 spaces).
30243024
3025− let indent = Tendril::from(doc.indent_unit());
3025+ let indent = Tendril::from(doc.indent_style.as_str());
30263026 let transaction = Transaction::insert(
30273027 doc.text(),
30283028 &doc.selection(view.id).clone().cursors(doc.text().slice(..)),
@@ -3122,7 +3122,7 @@ pub mod insert {
31223122 let count = cx.count();
31233123 let (view, doc) = current_ref!(cx.editor);
31243124 let text = doc.text().slice(..);
3125− let indent_unit = doc.indent_unit();
3125+ let indent_unit = doc.indent_style.as_str();
31263126 let tab_size = doc.tab_width();
31273127 let auto_pairs = doc.auto_pairs(cx.editor);
31283128
@@ -3647,7 +3647,7 @@ fn indent(cx: &mut Context) {
36473647 let lines = get_lines(doc, view.id);
36483648
36493649 // Indent by one level
3650− let indent = Tendril::from(doc.indent_unit().repeat(count));
3650+ let indent = Tendril::from(doc.indent_style.as_str().repeat(count));
36513651
36523652 let transaction = Transaction::change(
36533653 doc.text(),
helix-view/src/document.rs−8
@@ -1052,14 +1052,6 @@ impl Document {
10521052 .map_or(4, |config| config.tab_width) // fallback to 4 columns
10531053 }
10541054
1055− /// Returns a string containing a single level of indentation.
1056− ///
1057− /// TODO: we might not need this function anymore, since the information
1058− /// is conveniently available in `Document::indent_style` now.
1059− pub fn indent_unit(&self) -> &'static str {
1060− self.indent_style.as_str()
1061− }
1062−
10631055 pub fn changes(&self) -> &ChangeSet {
10641056 &self.changes
10651057 }