1/// Register selection and configuration
3/// This is a kind a of specialized `Option<char>` for register selection.
4/// Point is to keep whether the register selection has been explicitely
5/// set or not while being convenient by knowing the default register name.
7pub struct RegisterSelection {
12impl RegisterSelection {
13 pub fn new(default_name: char) -> Self {
15 selected: default_name,
20 pub fn select(&mut self, name: char) {
24 pub fn take(&mut self) -> Self {
26 selected: std::mem::replace(&mut self.selected, self.default_name),
27 default_name: self.default_name,
31 pub fn is_default(&self) -> bool {
32 self.selected == self.default_name
35 pub fn name(&self) -> char {
40impl Default for RegisterSelection {
41 fn default() -> Self {
42 let default_name = '"';
44 selected: default_name,
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list