Repository: zellij-org/zellij
File: src/terminal_pane/terminal_pane.rs (Rust)

Code before:
            let first_intermediate_is_questionmark = match _intermediates.get(0) {
                Some(b'?') => true,
                None => false,
                _ => false,
            };
            if first_intermediate_is_questionmark {
                if let Some(&25) = params.get(0) {
                    self.scroll.hide_cursor();
                    self.mark_for_rerender();
                };
            }
        } else if c == 'h' {
            let first_intermediate_is_questionmark = match _intermediates.get(0) {
                Some(b'?') => true,
                None => false,
                _ => false,
            };
            if first_intermediate_is_questionmark {
                if let Some(&25) = params.get(0) {
                    self.scroll.show_cursor();
                    self.mark_for_rerender();
                };
            }
        } else if c == 'r' {
            if params.len() > 1 {
                let top_line_index = params[0] as usize;
                let bottom_line_index = params[1] as usize;
                self.scroll
                    .set_scroll_region(top_line_index, bottom_line_index);
                self.scroll.show_cursor();
            } else {
                self.scroll.clear_scroll_region();
            }
        } else if c == 't' {
            // TBD - title?
        } else if c == 'n' {
            // TBD - device status report
        } else if c == 'c' {
            // TBD - identify terminal
        } else if c == 'M' {
            // delete lines if currently inside scroll region
            let line_count_to_delete = if params[0] == 0 {
                1
            } else {
                params[0] as usize
            };
            self.scroll
                .delete_lines_in_scroll_region(line_count_to_delete);
        } else if c == 'L' {
            // insert blank lines if inside scroll region
            let line_count_to_add = if params[0] == 0 {

Review comment (suggestion):
@5c077m4n - I can't comment on the lines below directly for some reason, but can we disable this clippy check? The one with the errors about the identical ifs. I would really like to leave it like this for now. The comments are super important and this block is generally very much in-flux as we keep reverse-engineering the VT100 protocol.

Code after:
            self.scroll.move_cursor_back(move_back_count);
        } else if c == 'l' {
            let first_intermediate_is_questionmark = match _intermediates.get(0) {
                Some(b'?') => true,
                None => false,
                _ => false,
            };
            if first_intermediate_is_questionmark {
                if let Some(&25) = params.get(0) {
                    self.scroll.hide_cursor();
                    self.mark_for_rerender();
                };
            }
        } else if c == 'h' {
            let first_intermediate_is_questionmark = match _intermediates.get(0) {
                Some(b'?') => true,
                None => false,
                _ => false,
            };
            if first_intermediate_is_questionmark {
                if let Some(&25) = params.get(0) {
                    self.scroll.show_cursor();
                    self.mark_for_rerender();
                };
            }
        } else if c == 'r' {
            if params.len() > 1 {
                let top_line_index = params[0] as usize;
                let bottom_line_index = params[1] as usize;
                self.scroll
                    .set_scroll_region(top_line_index, bottom_line_index);
                self.scroll.show_cursor();
            } else {
                self.scroll.clear_scroll_region();
            }
        } else if c == 't' {
            // TBD - title?
        } else if c == 'n' {
            // TBD - device status report
        } else if c == 'c' {
            // TBD - identify terminal
        } else if c == 'M' {
            // delete lines if currently inside scroll region
            let line_count_to_delete = if params[0] == 0 {
                1
            } else {
                params[0] as usize
            };
            self.scroll
                .delete_lines_in_scroll_region(line_count_to_delete);
        } else if c == 'L' {