Add fallback if selected color theme is not present
The fallback is the first available theme when sorted, this is to make things predictable and to get the same theme if you open the terminal multiple times
This commit is contained in:
parent
2903b10247
commit
c63e19eea3
1 changed files with 9 additions and 1 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -1135,7 +1135,15 @@ impl App {
|
|||
self.pane_model.focus = pane;
|
||||
match &self.term_event_tx_opt {
|
||||
Some(term_event_tx) => {
|
||||
match self.themes.get(&self.config.syntax_theme(profile_id_opt)) {
|
||||
let colors = self
|
||||
.themes
|
||||
.get(&self.config.syntax_theme(profile_id_opt))
|
||||
.or_else(|| {
|
||||
let mut keys: Vec<_> = self.themes.keys().collect();
|
||||
keys.sort_by(|a, b| (&a.0).cmp(&b.0));
|
||||
keys.first().and_then(|key| self.themes.get(key))
|
||||
});
|
||||
match colors {
|
||||
Some(colors) => {
|
||||
let current_pane = self.pane_model.focus;
|
||||
if let Some(tab_model) = self.pane_model.active_mut() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue