pub fn fix_last_edit_after_move(n1: usize, n2: usize, dest: usize) {
    let last_edit = g_get_last_edit();
    let mut new_last_edit = last_edit;

    if (n1..=n2).contains(&last_edit) {
        if dest < n1 {
            new_last_edit = last_edit - (n1 - dest);
        } else if dest > n2 {
            new_last_edit = last_edit + (dest - n2);
        }
    } else if dest == last_edit {
        if dest < n1 {
            new_last_edit = last_edit + (n2 - n1) + 1;
        } else if dest > n2 {
            new_last_edit = last_edit - (n2 - n1) - 1;
        }
    } else if n1 > last_edit && dest < last_edit {
        new_last_edit = last_edit + (n2 - n1) + 1;
    } else if n2 < last_edit && dest > last_edit {
        new_last_edit = last_edit - (n2 - n1) - 1;
    }

    g_set_last_edit(new_last_edit);
}
// Changes the last edit value after a move
// to reflect the new correct position
Changes the last edit value after a move
to reflect the new correct position
Changes the last edit value after a move to reflect the new correct position
pub fn fix_last_edit_after_move(n1: usize, n2: usize, dest: usize) {
    let last_edit = g_get_last_edit();
    let mut new_last_edit = last_edit;
    if (n1..=n2).contains(&last_edit) {
        if dest < n1 {
            new_last_edit = last_edit - (n1 - dest);
        } else if dest > n2 {
            new_last_edit = last_edit + (dest - n2);
        }
    } else if dest == last_edit {
        if dest < n1 {
            new_last_edit = last_edit + (n2 - n1) + 1;
        } else if dest > n2 {
            new_last_edit = last_edit - (n2 - n1) - 1;
        }
    } else if n1 > last_edit && dest < last_edit {
        new_last_edit = last_edit + (n2 - n1) + 1;
    } else if n2 < last_edit && dest > last_edit {
        new_last_edit = last_edit - (n2 - n1) - 1;
    }
    g_set_last_edit(new_last_edit);
}
pub fn fix_last_edit_after_move ( n1 : usize , n2 : usize , dest : usize ) { let last_edit = g_get_last_edit ( ) ; let mut new_last_edit = last_edit ; if ( n1 ..= n2 ) . contains ( & last_edit ) { if dest < n1 { new_last_edit = last_edit - ( n1 - dest ) ; } else if dest > n2 { new_last_edit = last_edit + ( dest - n2 ) ; } } else if dest == last_edit { if dest < n1 { new_last_edit = last_edit + ( n2 - n1 ) + 1 ; } else if dest > n2 { new_last_edit = last_edit - ( n2 - n1 ) - 1 ; } } else if n1 > last_edit && dest < last_edit { new_last_edit = last_edit + ( n2 - n1 ) + 1 ; } else if n2 < last_edit && dest > last_edit { new_last_edit = last_edit - ( n2 - n1 ) - 1 ; } g_set_last_edit ( new_last_edit ) ; }
Changes the last edit value after a move
to reflect the new correct position
Changes the last edit value after a move to reflect the new correct position
n1
usize
n2
usize
dest
usize