/// Get n'th previous ocurrence of a given charecter (relatively to the cursor)
Get n'th previous ocurrence of a given charecter (relatively to the cursor)
Get n ' th previous ocurrence of a given charecter ( relatively to the cursor )
pub fn previous_ocur(&self, c: char, n: usize) -> Option<usize> {
        let mut dn = 0;
        let mut x = self.x();
        let y = self.y();
        for (i, ch) in self.buffers.current_buffer()[y]
            .chars()
            .rev()
            .skip(self.buffers.current_buffer()[y].len() - x)
            .enumerate()
        {
            if ch == c {
                dn += 1;
                if dn == n {
                    x -= i + 1;
                    return Some(x);
                }
            }
        }
        None
    }
pub fn previous_ocur ( & self , c : char , n : usize ) -> Option < usize > { let mut dn = 0 ; let mut x = self . x ( ) ; let y = self . y ( ) ; for ( i , ch ) in self . buffers . current_buffer ( ) [ y ] . chars ( ) . rev ( ) . skip ( self . buffers . current_buffer ( ) [ y ] . len ( ) - x ) . enumerate ( ) { if ch == c { dn += 1 ; if dn == n { x -= i + 1 ; return Some ( x ) ; } } } None }
Get n'th previous ocurrence of a given charecter (relatively to the cursor)
Get n ' th previous ocurrence of a given charecter ( relatively to the cursor )
&self
c
char
n
usize