[PR #71] [MERGED] Implement different view traits/helpers Part I #86

Closed
opened 2026-03-14 12:31:29 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/aome510/hackernews-TUI/pull/71
Author: @aome510
Created: 5/1/2022
Status: Merged
Merged: 5/2/2022
Merged by: @aome510

Base: mainHead: impl-view-traits


📝 Commits (10+)

  • a61fe34 reimplement ScrollableList
  • 6bbb785 implement on_scroll_event_view traits and add scroll keymap
  • 62ba7e5 wip rewrite help view interface
  • d3b3c5d implement a basic help view for story view
  • a60c054 cleanup
  • f41e11c implement default other/view-navigation commands
  • 7a1e1b0 implement help view for comment view
  • 50ba876 implement help view for article view, search view, default help view
  • c852e01 add additional vim-like keybindings to scroll keymap
  • 5980f31 implement construct_on_event_help_view

📊 Changes

12 files changed (+637 additions, -476 deletions)

View changed files

📝 examples/hn-tui.toml (+8 -11)
📝 hackernews_tui/src/config/keybindings.rs (+28 -25)
📝 hackernews_tui/src/main.rs (+1 -1)
📝 hackernews_tui/src/utils.rs (+1 -1)
📝 hackernews_tui/src/view/article_view.rs (+15 -30)
📝 hackernews_tui/src/view/comment_view.rs (+47 -28)
📝 hackernews_tui/src/view/help_view.rs (+326 -256)
hackernews_tui/src/view/list_view.rs (+0 -116)
📝 hackernews_tui/src/view/mod.rs (+1 -1)
📝 hackernews_tui/src/view/search_view.rs (+1 -1)
📝 hackernews_tui/src/view/story_view.rs (+39 -6)
hackernews_tui/src/view/traits.rs (+170 -0)

📄 Description

Brief description of changes

  • implemented different view traits (defined in hackernews_tui/src/view/traits.rs)
    • ListViewContainer consists of methods to interact with the inner list view (LinearLayout)
    • ScrollViewContainer consists of methods to get the inner scroll view
    • OnScrollEventView defines the on_scroll_events method that adds callbacks for scrolling events (triggered by new ScrollKeymap keymaps)
    • AutoScrolling defines the scroll method that automatically scrolls to the inner view's important area
  • added a ScrollKeymap struct defined keybindings for scrolling commands
  • rewrote hackernews_tui/src/view/help_view.rs
    • added new Command and CommandGroup structs
    • defined the to_*_view method for the new structs to convert into the corresponding view
    • constructed the HelpView using the new structs instead of Vec<String, (String, String)> like previously
  • updated the example config file

Breaking changes

  • removed scrolling commands defined the ArticleViewKeymap and CommandViewKeymap in favour of commands defined by the new ScrollKeymap

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/aome510/hackernews-TUI/pull/71 **Author:** [@aome510](https://github.com/aome510) **Created:** 5/1/2022 **Status:** ✅ Merged **Merged:** 5/2/2022 **Merged by:** [@aome510](https://github.com/aome510) **Base:** `main` ← **Head:** `impl-view-traits` --- ### 📝 Commits (10+) - [`a61fe34`](https://github.com/aome510/hackernews-TUI/commit/a61fe343427b51ba509941719e26811a8c92bb1d) reimplement `ScrollableList` - [`6bbb785`](https://github.com/aome510/hackernews-TUI/commit/6bbb7851cf08faa1092d7641c62b4c8e2f41dbf3) implement on_scroll_event_view traits and add scroll keymap - [`62ba7e5`](https://github.com/aome510/hackernews-TUI/commit/62ba7e53dcf2f567bc2d5fec622c65f381ed28b4) wip rewrite help view interface - [`d3b3c5d`](https://github.com/aome510/hackernews-TUI/commit/d3b3c5d8341e472148d4de6b0eb61812e162917b) implement a basic help view for story view - [`a60c054`](https://github.com/aome510/hackernews-TUI/commit/a60c054f221b16524765a47421d53cbc003af760) cleanup - [`f41e11c`](https://github.com/aome510/hackernews-TUI/commit/f41e11c9d65068093d3057ba099f8c27e4ed945c) implement default other/view-navigation commands - [`7a1e1b0`](https://github.com/aome510/hackernews-TUI/commit/7a1e1b07d9d7d7a6d09bf29f10b48adc7596cedf) implement help view for comment view - [`50ba876`](https://github.com/aome510/hackernews-TUI/commit/50ba87656895cea2e1ab9aebd85640a0390f15bb) implement help view for article view, search view, default help view - [`c852e01`](https://github.com/aome510/hackernews-TUI/commit/c852e019998cf3990aefee0713de58881ab59968) add additional vim-like keybindings to scroll keymap - [`5980f31`](https://github.com/aome510/hackernews-TUI/commit/5980f313ec4927eb0681d90d61d7ce4d545132e8) implement `construct_on_event_help_view` ### 📊 Changes **12 files changed** (+637 additions, -476 deletions) <details> <summary>View changed files</summary> 📝 `examples/hn-tui.toml` (+8 -11) 📝 `hackernews_tui/src/config/keybindings.rs` (+28 -25) 📝 `hackernews_tui/src/main.rs` (+1 -1) 📝 `hackernews_tui/src/utils.rs` (+1 -1) 📝 `hackernews_tui/src/view/article_view.rs` (+15 -30) 📝 `hackernews_tui/src/view/comment_view.rs` (+47 -28) 📝 `hackernews_tui/src/view/help_view.rs` (+326 -256) ➖ `hackernews_tui/src/view/list_view.rs` (+0 -116) 📝 `hackernews_tui/src/view/mod.rs` (+1 -1) 📝 `hackernews_tui/src/view/search_view.rs` (+1 -1) 📝 `hackernews_tui/src/view/story_view.rs` (+39 -6) ➕ `hackernews_tui/src/view/traits.rs` (+170 -0) </details> ### 📄 Description ## Brief description of changes - implemented different view traits (defined in `hackernews_tui/src/view/traits.rs`) + `ListViewContainer` consists of methods to interact with the inner list view (`LinearLayout`) + `ScrollViewContainer` consists of methods to get the inner scroll view + `OnScrollEventView` defines the `on_scroll_events` method that adds callbacks for scrolling events (triggered by new `ScrollKeymap` keymaps) + `AutoScrolling` defines the `scroll` method that automatically scrolls to the inner view's important area - added a `ScrollKeymap` struct defined keybindings for scrolling commands - rewrote `hackernews_tui/src/view/help_view.rs` + added new `Command` and `CommandGroup` structs + defined the `to_*_view` method for the new structs to convert into the corresponding view + constructed the `HelpView` using the new structs instead of `Vec<String, (String, String)>` like previously - updated the example config file ## Breaking changes - removed scrolling commands defined the `ArticleViewKeymap` and `CommandViewKeymap` in favour of commands defined by the new `ScrollKeymap` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 12:31:29 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hackernews-TUI#86
No description provided.