Repository: bevyengine/bevy
File: tools/export-content/src/app.rs (Rust)

Code before:
                                if let Some(index) = mode_state.selected() {
                                    mode_entries.insert(
                                        index,
                                        Entry::Section {
                                            title: text.clone(),
                                        },
                                    );
                                }
                            }
                            self.text_entry = None;
                        }
                        KeyCode::Char(c) => text.push(c),
                        _ => {}
                    }

                    continue;
                }

                match key.code {
                    KeyCode::Esc => self.exit = true,
                    KeyCode::Tab => match self.mode {
                        Mode::ReleaseNotes => self.mode = Mode::MigrationGuides,
                        Mode::MigrationGuides => self.mode = Mode::ReleaseNotes,
                    },
                    KeyCode::Down => {
                        if key.modifiers.contains(KeyModifiers::SHIFT) {
                            if let Some(index) = mode_state.selected() {
                                if index < mode_entries.len() - 1 {
                                    mode_entries.swap(index, index + 1);
                                }
                            }
                        }
                        mode_state.select_next();
                    }
                    KeyCode::Up => {
                        if key.modifiers.contains(KeyModifiers::SHIFT) {
                            if let Some(index) = mode_state.selected() {
                                if index > 0 {
                                    mode_entries.swap(index, index - 1);
                                }
                            }
                        }
                        mode_state.select_previous();
                    }
                    KeyCode::Char('+') => {
                        self.text_entry = Some(String::new());
                    }
                    KeyCode::Char('d') => {
                        if let Some(index) = mode_state.selected() {
                            if let Entry::Section { .. } = mode_entries[index] {
                                mode_entries.remove(index);

Review comment (suggestion):
Nit: these could all be collapsed
```suggestion
                        if key.modifiers.contains(KeyModifiers::SHIFT)
                            && let Some(index) = mode_state.selected()
                            && index < mode_entries.len() - 1
                        {
```

Code after:
                                && let Some(index) = mode_state.selected()
                            {
                                mode_entries.insert(
                                    index,
                                    Entry::Section {
                                        title: text.clone(),
                                    },
                                );
                            }
                            self.text_entry = None;
                        }
                        KeyCode::Char(c) => text.push(c),
                        _ => {}
                    }

                    continue;
                }

                match key.code {
                    KeyCode::Esc => self.exit = true,
                    KeyCode::Tab => match self.mode {
                        Mode::ReleaseNotes => self.mode = Mode::MigrationGuides,
                        Mode::MigrationGuides => self.mode = Mode::ReleaseNotes,
                    },
                    KeyCode::Down => {
                        if key.modifiers.contains(KeyModifiers::SHIFT)
                            && let Some(index) = mode_state.selected()
                            && index < mode_entries.len() - 1
                        {
                            mode_entries.swap(index, index + 1);
                        }
                        mode_state.select_next();
                    }
                    KeyCode::Up => {
                        if key.modifiers.contains(KeyModifiers::SHIFT)
                            && let Some(index) = mode_state.selected()
                            && index > 0
                        {
                            mode_entries.swap(index, index - 1);
                        }
                        mode_state.select_previous();
                    }
                    KeyCode::Char('+') => {
                        self.text_entry = Some(String::new());
                    }
                    KeyCode::Char('d') => {
                        if let Some(index) = mode_state.selected()
                            && let Entry::Section { .. } = mode_entries[index]
                        {
                            mode_entries.remove(index);
                        }