fn render_line<W: Write>(
        &self,
        writer: &mut W,
        ind: usize,
        focus: bool,
        last: bool,
    ) -> io::Result<()> {
        let line = &self.tree.lines.lines[ind];
        let ending = if last { "" } else { "\r\n" };

        if focus {
            write!(
                writer,
                "{}{}{}{}{}{}{}",
                self.prefix_string(&line.prefix),
                if line.prefix.is_empty() { "" } else { " " },
                Bg(self.opts.bg_color.deref()),
                self.tree.tree[line.node].data.name,
                self.suffix_for_node(line.node),
                Bg(Reset),
                ending,
            )
        } else {
            write!(
                writer,
                "{}{}{}{}{}",
                self.prefix_string(&line.prefix),
                if line.prefix.is_empty() { "" } else { " " },
                self.tree.tree[line.node].data.name,
                self.suffix_for_node(line.node),
                if last { "" } else { "\r\n" }
            )
        }?;

        if last {
            writer.flush()
        } else {
            Ok(())
        }
    }
/// Render a single line of the tree.
///
/// Uses \r\n as a line ending since when terminal is in raw mode \n
/// alone does not move the cursor back to the beginning of the line.
Render a single line of the tree.
Uses \r\n as a line ending since when terminal is in raw mode \n
alone does not move the cursor back to the beginning of the line.
Render a single line of the tree . Uses \ r \ n as a line ending since when terminal is in raw mode \ n alone does not move the cursor back to the beginning of the line .
fn render_line<W: Write>(
        &self,
        writer: &mut W,
        ind: usize,
        focus: bool,
        last: bool,
    ) -> io::Result<()> {
        let line = &self.tree.lines.lines[ind];
        let ending = if last { "" } else { "\r\n" };
        if focus {
            write!(
                writer,
                "{}{}{}{}{}{}{}",
                self.prefix_string(&line.prefix),
                if line.prefix.is_empty() { "" } else { " " },
                Bg(self.opts.bg_color.deref()),
                self.tree.tree[line.node].data.name,
                self.suffix_for_node(line.node),
                Bg(Reset),
                ending,
            )
        } else {
            write!(
                writer,
                "{}{}{}{}{}",
                self.prefix_string(&line.prefix),
                if line.prefix.is_empty() { "" } else { " " },
                self.tree.tree[line.node].data.name,
                self.suffix_for_node(line.node),
                if last { "" } else { "\r\n" }
            )
        }?;
        if last {
            writer.flush()
        } else {
            Ok(())
        }
    }
fn render_line < W : Write > ( & self , writer : & mut W , ind : usize , focus : bool , last : bool , ) -> io :: Result < ( ) > { let line = & self . tree . lines . lines [ ind ] ; let ending = if last { " " } else { " \r \n " } ; if focus { write ! ( writer " " self prefix_string ( line prefix ) if line prefix is_empty ( ) { " " } else { " " } Bg ( self opts bg_color deref ( ) ) self tree tree [ line node ] data name self suffix_for_node ( line node ) Bg ( Reset ) ending ) } else { write ! ( writer " " self prefix_string ( line prefix ) if line prefix is_empty ( ) { " " } else { " " } self tree tree [ line node ] data name self suffix_for_node ( line node ) if last { " " } else { " \r \n " } ) } ? ; if last { writer . flush ( ) } else { Ok ( ( ) ) } }
Render a single line of the tree.
Render a single line of the tree .
&self
writer
&mut W
ind
usize
focus
bool
last
bool
&self
writer
&mut W
ind
usize
focus
bool
last
bool