Skip to content

Commit a6dc2d3

Browse files
committed
Added inline selection option to colored theme
1 parent a04103e commit a6dc2d3

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
# Changelog
22

3-
## 0.6.2
3+
## master
44

55
### Enhancements
66

7-
* Updating some docs
7+
* More secure password prompt
8+
* More documentation
9+
* Added `interact_text` method for input prompt
10+
* Added `inline_selections` to `ColorfulTheme`
811

912
### Breaking
1013

1114
* Removed `theme::CustomPromptCharacterTheme`
1215

16+
## 0.6.2
17+
18+
### Enhancements
19+
20+
* Updating some docs
21+
1322
## 0.6.1
1423

1524
### Bugfixes

src/theme.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ pub struct ColorfulTheme {
239239
pub picked_item_prefix: StyledObject<String>,
240240
/// Unpicked item in sort prefix value and style
241241
pub unpicked_item_prefix: StyledObject<String>,
242+
/// Show the selections from certain prompts inline
243+
pub inline_selections: bool,
242244
}
243245

244246
impl Default for ColorfulTheme {
@@ -262,6 +264,7 @@ impl Default for ColorfulTheme {
262264
unchecked_item_prefix: style("✔".to_string()).for_stderr().black(),
263265
picked_item_prefix: style("❯".to_string()).for_stderr().green(),
264266
unpicked_item_prefix: style(" ".to_string()).for_stderr(),
267+
inline_selections: true,
265268
}
266269
}
267270
}
@@ -429,13 +432,15 @@ impl Theme for ColorfulTheme {
429432

430433
write!(f, "{} ", &self.success_suffix)?;
431434

432-
for (idx, sel) in selections.iter().enumerate() {
433-
write!(
434-
f,
435-
"{}{}",
436-
if idx == 0 { "" } else { ", " },
437-
self.values_style.apply_to(sel)
438-
)?;
435+
if self.inline_selections {
436+
for (idx, sel) in selections.iter().enumerate() {
437+
write!(
438+
f,
439+
"{}{}",
440+
if idx == 0 { "" } else { ", " },
441+
self.values_style.apply_to(sel)
442+
)?;
443+
}
439444
}
440445

441446
Ok(())

0 commit comments

Comments
 (0)