summaryrefslogtreecommitdiffstats
path: root/default-plugins/status-bar/src
diff options
context:
space:
mode:
authorHenil Dedania <dedaniahenil@gmail.com>2021-11-05 13:59:45 +0530
committerGitHub <noreply@github.com>2021-11-05 09:29:45 +0100
commit4ac9344085a6a59e78608954cf89955f4e9ddb61 (patch)
tree2fe9fb7697ec92437af19ce77627c374f5db35ec /default-plugins/status-bar/src
parent3e052519f90b39e86f581fd0b8cabc0049736211 (diff)
feature(resize): Non directional resize (#520)
* feature(resize): Non directional resize * Implement special cases * fix resizing for panes that have `+` cross section * fix resizing for panes that have `T` cross section * fix panics * Add Nondirection resize keys to plugin * fix formatting * fix: clippy warnings * fix the last edge case * implemented some of the suggested changes * Remove helper function and elevate comment to top of function * Use `=` to keep it consistent with Normal mode mapping as its easier to use * Remove extra reference borrowing * fix an edge case * add test for nondirectional resize increase/decrease * fix(controls): add + to resize * refactor(resize): simplify methods * fix(resize): properly resize opposite corner pane Co-authored-by: Aram Drevekenin <aram@poor.dev>
Diffstat (limited to 'default-plugins/status-bar/src')
-rw-r--r--default-plugins/status-bar/src/second_line.rs67
1 files changed, 53 insertions, 14 deletions
diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs
index 0e59fcb8e..1b90443c0 100644
--- a/default-plugins/status-bar/src/second_line.rs
+++ b/default-plugins/status-bar/src/second_line.rs
@@ -90,14 +90,18 @@ fn quicknav_full(palette: Palette) -> LinePart {
let text_first_part = " Tip: ";
let alt = "Alt";
let text_second_part = " + ";
- let new_pane_shortcut = "n";
+ let new_pane_shortcut = "<n>";
let text_third_part = " => open new pane. ";
let second_alt = "Alt";
let text_fourth_part = " + ";
- let brackets_navigation = "[]";
+ let brackets_navigation = "<[]";
let text_fifth_part = " or ";
- let hjkl_navigation = "hjkl";
- let text_sixths_part = " => navigate between panes.";
+ let hjkl_navigation = "hjkl>";
+ let text_sixths_part = " => navigate between panes. ";
+ let third_alt = "Alt";
+ let text_seventh_parth = " + ";
+ let increase_decrease_parth = "<+->";
+ let text_eighth_parth = " => increase/decrease pane size.";
let len = text_first_part.chars().count()
+ alt.chars().count()
+ text_second_part.chars().count()
@@ -108,7 +112,11 @@ fn quicknav_full(palette: Palette) -> LinePart {
+ brackets_navigation.chars().count()
+ text_fifth_part.chars().count()
+ hjkl_navigation.chars().count()
- + text_sixths_part.chars().count();
+ + text_sixths_part.chars().count()
+ + third_alt.chars().count()
+ + text_seventh_parth.chars().count()
+ + increase_decrease_parth.chars().count()
+ + text_eighth_parth.chars().count();
let green_color = match palette.green {
PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
PaletteColor::EightBit(color) => Fixed(color),
@@ -119,7 +127,7 @@ fn quicknav_full(palette: Palette) -> LinePart {
};
LinePart {
part: format!(
- "{}{}{}{}{}{}{}{}{}{}{}",
+ "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
text_first_part,
Style::new().fg(orange_color).bold().paint(alt),
text_second_part,
@@ -134,6 +142,13 @@ fn quicknav_full(palette: Palette) -> LinePart {
text_fifth_part,
Style::new().fg(green_color).bold().paint(hjkl_navigation),
text_sixths_part,
+ Style::new().fg(orange_color).bold().paint(third_alt),
+ text_seventh_parth,
+ Style::new()
+ .fg(green_color)
+ .bold()
+ .paint(increase_decrease_parth),
+ text_eighth_parth,
),
len,
}
@@ -143,14 +158,18 @@ fn quicknav_medium(palette: Palette) -> LinePart {
let text_first_part = " Tip: ";
let alt = "Alt";
let text_second_part = " + ";
- let new_pane_shortcut = "n";
+ let new_pane_shortcut = "<n>";
let text_third_part = " => new pane. ";
let second_alt = "Alt";
let text_fourth_part = " + ";
- let brackets_navigation = "[]";
+ let brackets_navigation = "<[]";
let text_fifth_part = " or ";
- let hjkl_navigation = "hjkl";
- let text_sixths_part = " => navigate.";
+ let hjkl_navigation = "hjkl>";
+ let text_sixths_part = " => navigate. ";
+ let third_alt = "Alt";
+ let text_seventh_parth = " + ";
+ let increase_decrease_parth = "<+->";
+ let text_eighth_parth = " => resize pane. ";
let len = text_first_part.chars().count()
+ alt.chars().count()
+ text_second_part.chars().count()
@@ -161,7 +180,11 @@ fn quicknav_medium(palette: Palette) -> LinePart {
+ brackets_navigation.chars().count()
+ text_fifth_part.chars().count()
+ hjkl_navigation.chars().count()
- + text_sixths_part.chars().count();
+ + text_sixths_part.chars().count()
+ + third_alt.chars().count()
+ + text_seventh_parth.chars().count()
+ + increase_decrease_parth.chars().count()
+ + text_eighth_parth.chars().count();
let green_color = match palette.green {
PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
PaletteColor::EightBit(color) => Fixed(color),
@@ -172,7 +195,7 @@ fn quicknav_medium(palette: Palette) -> LinePart {
};
LinePart {
part: format!(
- "{}{}{}{}{}{}{}{}{}{}{}",
+ "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
text_first_part,
Style::new().fg(orange_color).bold().paint(alt),
text_second_part,
@@ -187,6 +210,13 @@ fn quicknav_medium(palette: Palette) -> LinePart {
text_fifth_part,
Style::new().fg(green_color).bold().paint(hjkl_navigation),
text_sixths_part,
+ Style::new().fg(orange_color).bold().paint(third_alt),
+ text_seventh_parth,
+ Style::new()
+ .fg(green_color)
+ .bold()
+ .paint(increase_decrease_parth),
+ text_eighth_parth,
),
len,
}
@@ -201,6 +231,8 @@ fn quicknav_short(palette: Palette) -> LinePart {
let brackets_navigation = "[]";
let text_fifth_part = "/";
let hjkl_navigation = "hjkl";
+ let text_sixth_part = "/";
+ let increase_decrease_part = "+-";
let len = text_first_part.chars().count()
+ alt.chars().count()
+ text_second_part.chars().count()
@@ -208,7 +240,9 @@ fn quicknav_short(palette: Palette) -> LinePart {
+ text_third_part.chars().count()
+ brackets_navigation.chars().count()
+ text_fifth_part.chars().count()
- + hjkl_navigation.chars().count();
+ + hjkl_navigation.chars().count()
+ + text_sixth_part.chars().count()
+ + increase_decrease_part.chars().count();
let green_color = match palette.green {
PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
PaletteColor::EightBit(color) => Fixed(color),
@@ -219,7 +253,7 @@ fn quicknav_short(palette: Palette) -> LinePart {
};
LinePart {
part: format!(
- "{}{}{}{}{}{}{}{}",
+ "{}{}{}{}{}{}{}{}{}{}",
text_first_part,
Style::new().fg(orange_color).bold().paint(alt),
text_second_part,
@@ -231,6 +265,11 @@ fn quicknav_short(palette: Palette) -> LinePart {
.paint(brackets_navigation),
text_fifth_part,
Style::new().fg(green_color).bold().paint(hjkl_navigation),
+ text_sixth_part,
+ Style::new()
+ .fg(green_color)
+ .bold()
+ .paint(increase_decrease_part),
),
len,
}