Skip to content

Commit 93e3559

Browse files
committed
refactor(help): Clarify that we're carrying over indentation
1 parent b1c46e6 commit 93e3559

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

clap_builder/src/output/textwrap/wrap_algorithms.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@ use super::core::display_width;
44
pub(crate) struct LineWrapper<'w> {
55
hard_width: usize,
66
line_width: usize,
7-
carryover: Option<&'w str>,
7+
indentation: Option<&'w str>,
88
}
99

1010
impl<'w> LineWrapper<'w> {
1111
pub(crate) fn new(hard_width: usize) -> Self {
1212
Self {
1313
hard_width,
1414
line_width: 0,
15-
carryover: None,
15+
indentation: None,
1616
}
1717
}
1818

1919
pub(crate) fn reset(&mut self) {
2020
self.line_width = 0;
21-
self.carryover = None;
21+
self.indentation = None;
2222
}
2323

2424
pub(crate) fn wrap(&mut self, mut words: Vec<&'w str>) -> Vec<&'w str> {
25-
if self.carryover.is_none() {
25+
if self.indentation.is_none() {
2626
if let Some(word) = words.first() {
2727
if word.trim().is_empty() {
28-
self.carryover = Some(*word);
28+
self.indentation = Some(*word);
2929
} else {
30-
self.carryover = Some("");
30+
self.indentation = Some("");
3131
}
3232
}
3333
}
@@ -48,9 +48,9 @@ impl<'w> LineWrapper<'w> {
4848
self.line_width = 0;
4949
words.insert(i, "\n");
5050
i += 1;
51-
if let Some(carryover) = self.carryover {
52-
words.insert(i, carryover);
53-
self.line_width += carryover.len();
51+
if let Some(indentation) = self.indentation {
52+
words.insert(i, indentation);
53+
self.line_width += indentation.len();
5454
i += 1;
5555
}
5656
}

0 commit comments

Comments
 (0)