Struct svgbob::Grid
[−]
[src]
pub struct Grid { /* fields omitted */ }
Methods
impl Grid
[src]
fn from_str(s: &str, settings: &Settings) -> Grid
instantiate a grid from input ascii text Issues: 1. 2-width, 5 bytes, single character i.e. 统 2. 1-width, 2 bytes, single character i.e. ö 3. 1-width, 3 bytes, single character i.e. o͡͡͡
fn to_string(&self) -> String
reassemble the Grid content into a string trimming unneeded whitespace to the right for every line
fn rows(&self) -> usize
fn columns(&self) -> usize
get the maximum row len
fn get(&self, loc: &Loc) -> Option<&String>
get a character at this location widths are computed since there are characters that spans 2 columns and characters that has 0 width
fn put(&mut self, loc: &Loc, s: &str)
put a text into this location prepare the grid for this location first
fn insert_line(&mut self, line: usize)
insert a new line to at this point
fn join_line(&mut self, line: usize)
join this line to the previous line
fn get_line_len(&self, line: usize) -> Option<usize>
get the line len at this index
fn accomodate(&mut self, loc: &Loc) -> Loc
prepare the grid to accomodate this loc if loc.y < 0 => insert abs(loc.y) rows at element 0 to self.index if loc.y > row.y => append (loc.y-row.y) rows to the self.x if loc.x < 0 => insert abs(loc.x) columns at element 0, to all rows if loc.x > row.x => append (loc.x-row.x) elements to the row returns the corrected location, -1,-1 will be on 0,0
fn get_text_in_range(&self, loc1: &Loc, loc2: &Loc) -> Vec<Vec<Option<&String>>>
Vector arranged in row x col
fn get_focuschar(&self, loc: &Loc) -> FocusChar
get the focus char at this location
fn get_svg(&self) -> SVG
get the generated svg according to the settings specified