-
-
Notifications
You must be signed in to change notification settings - Fork 614
Add search bar at bottom of revlog #506
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
Closed
Closed
Changes from all commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
f70b92a
Add search bar at bottom of revlog
WizardOhio24 2a5d9a8
Add esc to escape and fix invisible commit details
WizardOhio24 5cc8e7d
Remove unused lines
WizardOhio24 be0c76f
Fix revlog
WizardOhio24 bd5123a
Fix vim keys test
WizardOhio24 3414a05
Allow searching to happen live rather than press enter
WizardOhio24 07f4ec1
Filter commits in selected_entry
WizardOhio24 e8a6db5
Fix naming
WizardOhio24 95e3a70
Remove unused command
WizardOhio24 709b501
Allow escaping with esc again
WizardOhio24 b06a716
Auto set focus on filter commit to true
WizardOhio24 bfbcc9a
If filtering log get all commits
WizardOhio24 0e671b9
Change set total count to update total count in commitlist
WizardOhio24 1b1c6ee
Change key to bring up find commit box to :
WizardOhio24 21904ea
Don't show char count in find commit component
WizardOhio24 84ca7d2
Also filter by author
WizardOhio24 ab8770c
Add find commit to log commands
WizardOhio24 41c121e
esc on log tab to cancel search
WizardOhio24 56ef6be
Change search back to s
WizardOhio24 e6dd94a
Also update count when not filtering
WizardOhio24 b5fdceb
Fix h not working in text input
WizardOhio24 1ba3b23
Change tabs to spaces in keys.rs
WizardOhio24 504e0a9
Filter commits in commit log rather than commitlist
WizardOhio24 6930d73
Add extend item list to fetch commit
WizardOhio24 a505c05
Revert to 1ba3b23: Change tabs to spaces in keys.rs
WizardOhio24 db48ec5
Implement async filterer for commits
WizardOhio24 7c9fc66
Remove filter code from commitlist
WizardOhio24 9d3985d
Shutdown filter thread before starting another filter
WizardOhio24 47df534
Working async commit filter
WizardOhio24 b2d2f82
Fix async filter thread terminating upon finishing search
WizardOhio24 70ca71a
Set commit length when retrieving filtered commits
WizardOhio24 cd938f6
Finish filter if 0 recieved rather than <=1
WizardOhio24 fdf2fad
Make search case insensitive
WizardOhio24 d3abde6
Fix clippy warning
WizardOhio24 ebbe26e
Add a filter function using : in search to filter by sha, author or m…
WizardOhio24 16da8a0
Remove expect
WizardOhio24 0114cbf
Change async filter sleep durations
WizardOhio24 b4cf798
Trim whitespace
WizardOhio24 0be4840
Allow union filtering with ||
WizardOhio24 05c734c
Use rayon core for thread and add work pending
WizardOhio24 bf0d6ea
Fix sleep timings so filter runs quicker
WizardOhio24 933d4c5
Store state locally for quicker return if no work pending
WizardOhio24 9578e8d
Use refcell to fix is_pending
WizardOhio24 e9eeb53
Allow &&(intersection) and ||(union) filtering
WizardOhio24 f442c33
Use mutexes to prevent several threads filtering at once
WizardOhio24 ae01732
Clear filtered commits when starting a new search in thread
WizardOhio24 c5b469b
Use parking log mutex
WizardOhio24 8fc599d
Fix import order
WizardOhio24 524ddcc
Fix spinner up before filter
WizardOhio24 06d6ade
Remove filter_thread_running
WizardOhio24 7ed2cda
Remove unneeded comments
WizardOhio24 c444aaa
Make filter function more succinct
WizardOhio24 5bd747b
Remove clippy allow too many lines
WizardOhio24 8db4523
Fix brackets in filter function
WizardOhio24 a1cd020
Remove reset values from start_filter in main thread
WizardOhio24 126431a
Remove clear function from async filter
WizardOhio24 7a416de
Move try_recv to before getting slice of commits
WizardOhio24 d70e149
Add complement search
WizardOhio24 a2faf29
Support case sensitive filtering
WizardOhio24 571c401
Add comment to filter function explaining what input is expected
WizardOhio24 d5d24fb
Fix clippy warnings and not revlog filter by
WizardOhio24 712fb82
Fix filter if no leading :
WizardOhio24 529cc74
Support filtering by tags
WizardOhio24 f4f5b6e
Support brackets in search
WizardOhio24 9c51df3
Allow nested brackets
WizardOhio24 f6863d0
Fix clippy
WizardOhio24 a361c70
Fix clippy
WizardOhio24 a0b9af5
Support nested brackets and fix not tag search to show commits with n…
WizardOhio24 1647357
Remove unneeded comments
WizardOhio24 507d6f8
Small varible name change
WizardOhio24 32eb3e2
Reset LIMIT_COUNT in revlog to 3000
WizardOhio24 501a194
Remove unneeded logging
WizardOhio24 fe6d817
Remove amount argument from fetch_helper
WizardOhio24 447d095
Move comment above derive
WizardOhio24 e68938d
Create function get_tags
WizardOhio24 71582a7
Remove added ;
WizardOhio24 f933bf2
Add comment to get_ending_bracket
WizardOhio24 d1c3b54
Add comment to remove_out_brackets
WizardOhio24 1f133c7
Only re-filter if string is different
WizardOhio24 6124b9b
Add filter_string to new revlog
WizardOhio24 4b07b3a
Change back to set_total_count in commitlist
WizardOhio24 d70cc4f
Fix clippy warnings and change while to for in get_ending_bracket
WizardOhio24 2d3cf33
Fix search by trimming string
WizardOhio24 7b610b3
Add brackets round tag filter in async_filter
WizardOhio24 6ab22fa
Add search filter commits to readme
WizardOhio24 2a99ed5
Remove is_and && from filter
WizardOhio24 c777ef3
Remove ALT down to focus on search
WizardOhio24 3fe9a33
Remove comment about getting tags from start_filter
WizardOhio24 dd158e0
Remove continue filter comment
WizardOhio24 843ff3b
Merge branch 'master' into find-sha
WizardOhio24 b0ee951
Fix merge problems
WizardOhio24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
use super::{ | ||
textinput::TextInputComponent, CommandBlocking, CommandInfo, | ||
Component, DrawableComponent, | ||
}; | ||
use crate::{ | ||
keys::SharedKeyConfig, | ||
queue::{InternalEvent, Queue}, | ||
strings, | ||
ui::style::SharedTheme, | ||
}; | ||
use anyhow::Result; | ||
use crossterm::event::Event; | ||
use tui::{backend::Backend, layout::Rect, Frame}; | ||
|
||
pub struct FindCommitComponent { | ||
input: TextInputComponent, | ||
queue: Queue, | ||
is_focused: bool, | ||
visible: bool, | ||
key_config: SharedKeyConfig, | ||
} | ||
|
||
impl DrawableComponent for FindCommitComponent { | ||
fn draw<B: Backend>( | ||
&self, | ||
f: &mut Frame<B>, | ||
rect: Rect, | ||
) -> Result<()> { | ||
self.input.draw(f, rect)?; | ||
Ok(()) | ||
} | ||
} | ||
|
||
impl Component for FindCommitComponent { | ||
fn commands( | ||
&self, | ||
_out: &mut Vec<CommandInfo>, | ||
_force_all: bool, | ||
) -> CommandBlocking { | ||
CommandBlocking::PassingOn | ||
} | ||
|
||
fn event(&mut self, ev: Event) -> Result<bool> { | ||
if self.is_visible() && self.focused() { | ||
if let Event::Key(e) = ev { | ||
if e == self.key_config.exit_popup { | ||
// Prevent text input closing | ||
self.focus(false); | ||
self.visible = false; | ||
return Ok(true); | ||
} | ||
} | ||
if self.input.event(ev)? { | ||
self.queue.borrow_mut().push_back( | ||
InternalEvent::FilterLog( | ||
self.input.get_text().to_string(), | ||
), | ||
); | ||
return Ok(true); | ||
} | ||
} | ||
Ok(false) | ||
} | ||
|
||
fn is_visible(&self) -> bool { | ||
self.visible | ||
} | ||
|
||
fn hide(&mut self) { | ||
self.visible = false; | ||
} | ||
fn show(&mut self) -> Result<()> { | ||
self.visible = true; | ||
Ok(()) | ||
} | ||
|
||
fn focus(&mut self, focus: bool) { | ||
self.is_focused = focus; | ||
} | ||
|
||
fn focused(&self) -> bool { | ||
self.is_focused | ||
} | ||
|
||
fn toggle_visible(&mut self) -> Result<()> { | ||
self.visible = !self.visible; | ||
Ok(()) | ||
} | ||
} | ||
|
||
impl FindCommitComponent { | ||
/// | ||
pub fn new( | ||
queue: Queue, | ||
theme: SharedTheme, | ||
key_config: SharedKeyConfig, | ||
) -> Self { | ||
let mut input_component = TextInputComponent::new( | ||
theme, | ||
key_config.clone(), | ||
&strings::find_commit_title(&key_config), | ||
&strings::find_commit_msg(&key_config), | ||
false, | ||
); | ||
input_component.show().expect("Will not error"); | ||
input_component.set_should_use_rect(true); | ||
Self { | ||
queue, | ||
input: input_component, | ||
key_config, | ||
visible: false, | ||
is_focused: false, | ||
} | ||
} | ||
|
||
pub fn clear_input(&mut self) { | ||
self.input.clear(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
what reasoning went into using
Mutex
fromparking_lot
vs using the regularMutex
fromstd
that we use everywhere else?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.
This was because I think it's faster and it's already used as a dependency in some of the crates GitUI uses, happy to use the normal mutexes instead though.
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.
yeah lets keep it consistent