New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input bar at the top if we are in inline mode #866
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
It feels like the exit at most recent behavior is quite biting when trying to get used to the new direction. That probably should be made optional, or require two consecutive presses to actually exit. I've commented it out to test how it goes:
I guess the main issue with it is that you cannot tell if you are on the most recent command. |
@@ -13,6 +13,7 @@ use super::format_duration; | |||
pub struct HistoryList<'a> { | |||
history: &'a [History], | |||
block: Option<Block<'a>>, | |||
inverted: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funny, we almost got to the same solution, here's what I had in stash:
diff --git a/src/command/client/search/history_list.rs b/src/command/client/search/history_list.rs
index eedab1a5..a7af8777 100644
--- a/src/command/client/search/history_list.rs
+++ b/src/command/client/search/history_list.rs
@@ -13,6 +13,7 @@ use super::format_duration;
pub struct HistoryList<'a> {
history: &'a [History],
block: Option<Block<'a>>,
+ reversed: bool,
}
#[derive(Default)]
@@ -59,8 +60,9 @@ impl<'a> StatefulWidget for HistoryList<'a> {
buf,
list_area,
x: 0,
- y: 0,
+ y: if self.reversed { list_area.height } else { 0 },
state,
+ reversed: self.reversed,
};
for item in self.history.iter().skip(state.offset).take(end - start) {
@@ -70,17 +72,18 @@ impl<'a> StatefulWidget for HistoryList<'a> {
s.command(item);
// reset line
- s.y += 1;
+ s.y = if self.reversed { s.y - 1 } else { s.y + 1 };
s.x = 0;
}
}
}
impl<'a> HistoryList<'a> {
- pub fn new(history: &'a [History]) -> Self {
+ pub fn new(history: &'a [History], reversed: bool) -> Self {
Self {
history,
block: None,
+ reversed,
}
}
@@ -110,6 +113,7 @@ struct DrawState<'a> {
x: u16,
y: u16,
state: &'a ListState,
+ reversed: bool,
}
// longest line prefix I could come up with
diff --git a/src/command/client/search/interactive.rs b/src/command/client/search/interactive.rs
index 21ffb800..20aa3848 100644
--- a/src/command/client/search/interactive.rs
+++ b/src/command/client/search/interactive.rs
@@ -294,7 +294,7 @@ impl State {
let stats = self.build_stats();
f.render_widget(stats, header_chunks[2]);
- let results_list = Self::build_results_list(compact, results);
+ let results_list = Self::build_results_list(compact, results, inline_mode);
f.render_stateful_widget(results_list, results_list_chunk, &mut self.results_state);
let input = self.build_input(compact, input_chunk.width.into());
@@ -352,11 +352,11 @@ impl State {
stats
}
- fn build_results_list(compact: bool, results: &[History]) -> HistoryList {
+ fn build_results_list(compact: bool, results: &[History], reversed: bool) -> HistoryList {
let results_list = if compact {
- HistoryList::new(results)
+ HistoryList::new(results, reversed)
} else {
- HistoryList::new(results).block(
+ HistoryList::new(results, reversed).block(
Block::default()
.borders(Borders::TOP | Borders::LEFT | Borders::RIGHT)
.border_type(BorderType::Rounded),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha nice! very similar :D
I'm loving it so far :) |
awesome! I'll probably get it merged and gated behind some config soon then |
188bbb4
to
a988cd2
Compare
c9a96b1
to
6906c10
Compare
Love this change ❤️ Thanks for adding it! |
After merging this, I'm working on configurable UI before v15
The idea there is that we can control much more than just compact etc, and toggle each part of the UI to preference. Including where the input bar is
Thanks @pdecat for most of the work here! Based this off of #808
This does feel kinda weird with the up arrow binding