@@ 658,7 658,7 @@ impl View for EditorView {
* but not the text. We cannot draw a style directly
* so we'll need to print the same text over. */
// `span`: (x_range, line_idx)
- let print_span_text = |printer: &Printer, span: (Range<usize>, usize)| {
+ let print_span_text = |printer: &Printer, span: (&Range<usize>, usize)| {
let (x_range, line_idx) = span;
let line = self.lines.get(&line_idx)
.map(|s| s.as_str())
@@ 692,16 692,16 @@ impl View for EditorView {
};
// Draw selection.
- for &(line_idx, ref x_range) in self.selections.iter() {
- printer.with_selection(true, |printer|
- print_span_text(printer, (x_range.clone(), line_idx))
- );
- }
+ printer.with_selection(true, |printer|
+ for &(line_idx, ref x_range) in self.selections.iter() {
+ print_span_text(printer, (x_range, line_idx))
+ }
+ );
// Draw the cursor.
for &(line_idx, x, style) in self.cursors.iter() {
printer.with_style(style, |printer|
- print_span_text(printer, (x..x + 1, line_idx))
+ print_span_text(printer, (&(x..x + 1), line_idx))
);
}
}