File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,14 @@ pub trait WriteSource: std::fmt::Debug {
31
31
Some ( r)
32
32
}
33
33
34
+ /// Attempts to write the current item, expanding the maximum width where necessary.
34
35
fn write_or_expand ( & self , mut opt : WriteOpt ) -> String {
35
36
loop {
36
37
if let Some ( s) = self . write ( opt. clone ( ) ) {
37
38
return s;
38
39
} else {
40
+ // TODO: could we just set the max width rather than increasing
41
+ // it in a loop?
39
42
opt. max_width += opt. max_width / 2 ;
40
43
opt. reset_line ( ) ;
41
44
}
@@ -113,6 +116,8 @@ impl WriteOpt {
113
116
Some ( ( ) )
114
117
}
115
118
119
+ /// Sets [WriteOpt::rem_width] to (max_width - indent_width), returning
120
+ /// `Some(())`, or `None` if there's not enough space.
116
121
fn reset_line ( & mut self ) -> Option < ( ) > {
117
122
let ident = self . tab . len ( ) as u16 * self . indent ;
118
123
self . rem_width = self . max_width . checked_sub ( ident) ?;
You can’t perform that action at this time.
0 commit comments