diff options
author | Sam Tay <sam.chong.tay@gmail.com> | 2020-06-25 14:40:28 -0700 |
---|---|---|
committer | Sam Tay <sam.chong.tay@gmail.com> | 2020-06-25 14:40:28 -0700 |
commit | 02bb73d1dea45db810ac2ae17d9870f0df355b4c (patch) | |
tree | f73c50ff3babb6a833786efc4e6bdce8e9ac0fb1 | |
parent | 222710ce69e762bf49980c3805d2dfe686f793b2 (diff) |
Fix switching focus in single-col/fullscreen layouts
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | TODO.md | 3 | ||||
-rw-r--r-- | src/tui/views.rs | 10 |
3 files changed, 11 insertions, 9 deletions
@@ -28,9 +28,10 @@ $ so -e google -s askubuntu -s stackoverflow -s unix how do i install linux ### release binaries The quickest installation method is to download the appropriate -binary from the [release artifacts](TODO link). Right now I'm only building the -most common targets, but in theory it should be easy to add more, so if you -don't see what you are looking for just open an issue and I can add it. Here's a +binary from the [release artifacts](https://github.com/samtay/so/releases). +Right now I'm only building the most common targets, but in theory it should be +easy to add more, so if you don't see what you are looking for just open an +issue and I can add it. Here's a list of the [supported targets](https://github.com/japaric/trust#supported-targets). You can quickly install the binary for your OS with: @@ -6,7 +6,8 @@ [installation](https://github.com/casey/just) (this is also a good example of github actions). 2. Move to github actions ASAP, travis & appveyor are a PITA. See resources below. 3. Benchmark parsing. Probaly way faster to use regex to find question IDs - within URLs (or the entire doc). + within URLs (or *gasp* the entire doc). +4. Refactor layout handling (see TODO on `tui::views::LayoutView::relayout`) ### bugs 1. Need to also allow /q/ in search results in addition to /questions/ diff --git a/src/tui/views.rs b/src/tui/views.rs index c131455..2e2fc4d 100644 --- a/src/tui/views.rs +++ b/src/tui/views.rs @@ -324,10 +324,8 @@ impl ViewWrapper for LayoutView { } fn wrap_layout(&mut self, size: Vec2) { - if self.layout_invalidated || self.size_invalidated { - self.resize(size); - self.relayout(); - } + self.resize(size); + self.relayout(); self.size_invalidated = false; self.layout_invalidated = false; self.view.layout(size); @@ -383,6 +381,8 @@ impl LayoutView { self.call_on_md_views(move |v| v.resize(&width, &view_height)); } + // TODO separate out resizing | relayout | refocus; these are separate + // concerns and should have their own methods of invalidation fn relayout(&mut self) { match self.layout { Layout::BothColumns => { @@ -429,8 +429,8 @@ impl LayoutView { Layout::FullScreen => { self.call_on_md_views(|v| { v.show_title(); - v.set_take_focus(true); v.hide(); + v.set_take_focus(true); v.resize(&SizeConstraint::Full, &SizeConstraint::Full); }); self.call_on_list_views(|v| { |