1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 05:12:40 +03:00

launcher: consistently order entries

This commit is contained in:
Wez Furlong 2022-01-16 20:59:51 -07:00
parent b6141d650e
commit 631f7869a5
2 changed files with 6 additions and 3 deletions

View File

@ -18,6 +18,7 @@ use mux::tab::TabId;
use mux::termwiztermtab::TermWizTerminal;
use mux::window::WindowId;
use mux::Mux;
use std::collections::BTreeMap;
use termwiz::cell::{AttributeChange, CellAttributes};
use termwiz::color::ColorAttribute;
use termwiz::input::{InputEvent, KeyCode, KeyEvent, MouseButtons, MouseEvent};
@ -302,7 +303,9 @@ impl LauncherState {
if args.flags.contains(LauncherFlags::KEY_ASSIGNMENTS) {
let input_map = InputMap::new(&config);
let mut key_entries: Vec<Entry> = vec![];
for ((keycode, mods), assignment) in input_map.keys {
// Give a consistent order to the entries
let keys: BTreeMap<_, _> = input_map.keys.into_iter().collect();
for ((keycode, mods), assignment) in keys {
if matches!(
&assignment,
KeyAssignment::ActivateTabRelative(_) | KeyAssignment::ActivateTab(_)

View File

@ -14,7 +14,7 @@ pub type ScreenPoint = euclid::Point2D<isize, ScreenPixelUnit>;
/// Which key is pressed. Not all of these are probable to appear
/// on most systems. A lot of this list is @wez trawling docs and
/// making an entry for things that might be possible in this first pass.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize, Ord, PartialOrd)]
pub enum KeyCode {
/// The decoded unicode character
Char(char),
@ -353,7 +353,7 @@ impl ToString for Modifiers {
/// These keycodes identify keys based on their physical
/// position on an ANSI-standard US keyboard.
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq, Hash, Copy)]
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq, Hash, Copy, Ord, PartialOrd)]
pub enum PhysKeyCode {
A,
B,