fn scroll(&mut self) {
        self.rx = if self.position.cy < self.rows.len() {
            let row = &self.rows[self.position.cy];
            let xpos = self.position.cx;
            row.cx_to_rx(xpos)
        } else {
            0
        };
        // scroll before page
        if self.position.cy < self.position.rowoff {
            self.position.rowoff = self.position.cy;
        }
        // scroll past page
        if self.position.cy >= self.position.rowoff + self.screenrows {
            // one page up from current y pos
            self.position.rowoff = self.position.cy - self.screenrows + 1;
        }
        if self.rx < self.position.coloff {
            self.position.coloff = self.rx;
        }
        if self.rx >= self.position.coloff + self.screencols {
            self.position.coloff = self.rx - self.screencols + 1;
        }
    }
/// Change thie visible portion of the file
///
/// After processing any movement cursor commands, a call to scroll adjusts the
/// `rowoff`/`coloff` fields to change if we had moved ahead or behind of what
/// portion of the file is currently visible.
Change thie visible portion of the file
After processing any movement cursor commands, a call to scroll adjusts the
`rowoff`/`coloff` fields to change if we had moved ahead or behind of what
portion of the file is currently visible.
Change thie visible portion of the file After processing any movement cursor commands a call to scroll adjusts the ` rowoff ` / ` coloff ` fields to change if we had moved ahead or behind of what portion of the file is currently visible .
fn scroll(&mut self) {
        self.rx = if self.position.cy < self.rows.len() {
            let row = &self.rows[self.position.cy];
            let xpos = self.position.cx;
            row.cx_to_rx(xpos)
        } else {
            0
        };
        // scroll before page
        if self.position.cy < self.position.rowoff {
            self.position.rowoff = self.position.cy;
        }
        // scroll past page
        if self.position.cy >= self.position.rowoff + self.screenrows {
            // one page up from current y pos
            self.position.rowoff = self.position.cy - self.screenrows + 1;
        }
        if self.rx < self.position.coloff {
            self.position.coloff = self.rx;
        }
        if self.rx >= self.position.coloff + self.screencols {
            self.position.coloff = self.rx - self.screencols + 1;
        }
    }
fn scroll ( & mut self ) { self . rx = if self . position . cy < self . rows . len ( ) { let row = & self . rows [ self . position . cy ] ; let xpos = self . position . cx ; row . cx_to_rx ( xpos ) } else { 0 } ; // scroll before page if self . position . cy < self . position . rowoff { self . position . rowoff = self . position . cy ; } // scroll past page if self . position . cy >= self . position . rowoff + self . screenrows { // one page up from current y pos self . position . rowoff = self . position . cy - self . screenrows + 1 ; } if self . rx < self . position . coloff { self . position . coloff = self . rx ; } if self . rx >= self . position . coloff + self . screencols { self . position . coloff = self . rx - self . screencols + 1 ; } }
Change thie visible portion of the file
After processing any movement cursor commands, a call to scroll adjusts the
`rowoff`/`coloff` fields to change if we had moved ahead or behind of what
portion of the file is currently visible.
Change thie visible portion of the file After processing any movement cursor commands a call to scroll adjusts the ` rowoff ` / ` coloff ` fields to change if we had moved ahead or behind of what portion of the file is currently visible .
&mut self