pub(crate) fn adjust_offset(
    app: &mut Data,
    display: &mut ScreenHandler,
    labels: &mut LabelHandler,
) {
    let bytes_per_line = display.comp_layouts.bytes_per_line;
    let bytes_per_screen = bytes_per_line * display.comp_layouts.lines_per_screen;

    if app.offset < app.start_address {
        app.start_address = (app.offset / bytes_per_line) * bytes_per_line;
    } else if app.offset >= app.start_address + (bytes_per_screen) {
        app.start_address =
            (app.offset / bytes_per_line) * bytes_per_line - bytes_per_screen + bytes_per_line;
    }

    labels.offset = format!("{:#X}", app.offset);
}
Moves the starting address of the editor viewports (Hex and ASCII) to include the cursor.
This is helpful because some window actions (search, jump to byte) move the cursor, and we
want to move the screen along with it.

If the cursor's location is before the viewports start, the viewports will move so that the
cursor is included in the first row.

If the cursor's location is past the end of the viewports, the viewports will move so that
the cursor is included in the final row.
src/windows/mod.rs