fn draw_status_bar(&self) {
		let mut status;
		let width = self.terminal.size().width as usize;
		let mut file_name = "[No Name]".to_string();

		// File status - name, len
		if let Some(name) = &self.document.file_name {
			file_name = name.clone();
			file_name.truncate(20);
		}
		status = format!("{} - {} lines", file_name, self.document.len());
		
		// Line indicator
		let line_indicator = format!(
			"{}/{}",
			self.cursor_position.y.saturating_add(1),
			self.document.len()
		);

		let len = status.len() + line_indicator.len();
		if width > len {
			status.push_str(&" ".repeat(width - len));
		}		
		status = format!("{}{}", status, line_indicator);
		status.truncate(width);

		Terminal::set_bg_color(STATUS_BG_COLOR);
		Terminal::set_fg_color(STATUS_FG_COLOR);
		println!("{}\r", status);
		Terminal::reset_fg_color();
		Terminal::reset_bg_color();
	}
/*
		Draw colored status bar with info
	*/
Draw colored status bar with info
Draw colored status bar with info
fn draw_status_bar(&self) {
		let mut status;
		let width = self.terminal.size().width as usize;
		let mut file_name = "[No Name]".to_string();
		// File status - name, len
		if let Some(name) = &self.document.file_name {
			file_name = name.clone();
			file_name.truncate(20);
		}
		status = format!("{} - {} lines", file_name, self.document.len());
		// Line indicator
		let line_indicator = format!(
			"{}/{}",
			self.cursor_position.y.saturating_add(1),
			self.document.len()
		);
		let len = status.len() + line_indicator.len();
		if width > len {
			status.push_str(&" ".repeat(width - len));
		}		
		status = format!("{}{}", status, line_indicator);
		status.truncate(width);
		Terminal::set_bg_color(STATUS_BG_COLOR);
		Terminal::set_fg_color(STATUS_FG_COLOR);
		println!("{}\r", status);
		Terminal::reset_fg_color();
		Terminal::reset_bg_color();
	}
fn draw_status_bar ( & self ) { let mut status ; let width = self . terminal . size ( ) . width as usize ; let mut file_name = " " . to_string ( ) ; // File status - name, len if let Some ( name ) = & self . document . file_name { file_name = name . clone ( ) ; file_name . truncate ( 20 ) ; } status = format ! ( " " file_name self document len ( ) ) ; // Line indicator let line_indicator = format ! ( " " self cursor_position y saturating_add ( 1 ) self document len ( ) ) ; let len = status . len ( ) + line_indicator . len ( ) ; if width > len { status . push_str ( & " " . repeat ( width - len ) ) ; } status = format ! ( " " status line_indicator ) ; status . truncate ( width ) ; Terminal :: set_bg_color ( STATUS_BG_COLOR ) ; Terminal :: set_fg_color ( STATUS_FG_COLOR ) ; println ! ( " \r " status ) ; Terminal :: reset_fg_color ( ) ; Terminal :: reset_bg_color ( ) ; }
Draw colored status bar with info
Draw colored status bar with info
&self
&self