[PR #72] [MERGED] Refactor link handler codes #88

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/72
Author: @aome510
Created: 5/2/2022
Status: Merged
Merged: 5/3/2022
Merged by: @aome510

Base: mainHead: impl-view-traits-2


📝 Commits (10+)

  • 66ee553 separate crate::utils and crate::view::utils
  • 098aa40 add utils functions to open ith link in browser/article view
  • 88a1f4e add LinkDialog
  • ad59d65 add link dialog keymap and open_link_dialog command
  • 0b7bd6a remove redundant files
  • c76fd28 update link commands' keybindings in each view
  • ac5327e move event callbacks constructing code to get_comment_main_view function
  • 8c84b3f add link_dialog.rs
  • 4628784 cleanup OnEventView construct codes
  • da6c968 update help_view

📊 Changes

18 files changed (+445 additions, -371 deletions)

View changed files

📝 .gitignore (+1 -1)
📝 README.md (+53 -52)
📝 examples/hn-tui.toml (+15 -9)
📝 hackernews_tui/src/client/parser.rs (+19 -0)
📝 hackernews_tui/src/client/query.rs (+1 -1)
📝 hackernews_tui/src/config/keybindings.rs (+36 -12)
📝 hackernews_tui/src/prelude.rs (+1 -1)
📝 hackernews_tui/src/utils.rs (+0 -73)
📝 hackernews_tui/src/view/article_view.rs (+16 -87)
📝 hackernews_tui/src/view/async_view.rs (+2 -2)
📝 hackernews_tui/src/view/comment_view.rs (+41 -74)
📝 hackernews_tui/src/view/error_view.rs (+1 -1)
📝 hackernews_tui/src/view/help_view.rs (+46 -37)
hackernews_tui/src/view/link_dialog.rs (+100 -0)
📝 hackernews_tui/src/view/mod.rs (+2 -0)
📝 hackernews_tui/src/view/search_view.rs (+5 -4)
📝 hackernews_tui/src/view/story_view.rs (+13 -17)
hackernews_tui/src/view/utils.rs (+93 -0)

📄 Description

Brief description of changes

  • updated default shortcuts REAMDE
  • added view::utils.rs to separate view utils with general util functions defined in utils.rs
  • clean imports in files of the view module
  • implemented LinkDialog struct (along with traits, keymaps, etc)
  • changed on_event to on_pre_event to handle the events before its children receive the events
  • updated the behaviour of open_article_in_browser when the story doesn't have linked article: fallback to open_story_in_browser

Breaking changes

  • modified the default shortcuts for link opening commands. Look into here for further details

🔄 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/72 **Author:** [@aome510](https://github.com/aome510) **Created:** 5/2/2022 **Status:** ✅ Merged **Merged:** 5/3/2022 **Merged by:** [@aome510](https://github.com/aome510) **Base:** `main` ← **Head:** `impl-view-traits-2` --- ### 📝 Commits (10+) - [`66ee553`](https://github.com/aome510/hackernews-TUI/commit/66ee5539d238c66d72fe02dd602dd429b8f34759) separate `crate::utils` and `crate::view::utils` - [`098aa40`](https://github.com/aome510/hackernews-TUI/commit/098aa40e074f8837859f8b605f120aeaa74393b6) add utils functions to open ith link in browser/article view - [`88a1f4e`](https://github.com/aome510/hackernews-TUI/commit/88a1f4ef2e4d77548b3806bafdf30abd32be6f02) add `LinkDialog` - [`ad59d65`](https://github.com/aome510/hackernews-TUI/commit/ad59d65c97cdec60640bacb8e4cda8fa21274df0) add link dialog keymap and `open_link_dialog` command - [`0b7bd6a`](https://github.com/aome510/hackernews-TUI/commit/0b7bd6adc61881f6ae027d39073fececd824654b) remove redundant files - [`c76fd28`](https://github.com/aome510/hackernews-TUI/commit/c76fd28382c537820079e8eaa2fac6d0152b7ee7) update link commands' keybindings in each view - [`ac5327e`](https://github.com/aome510/hackernews-TUI/commit/ac5327ec97437c8ac014ba353c83f39dd106b8d6) move event callbacks constructing code to `get_comment_main_view` function - [`8c84b3f`](https://github.com/aome510/hackernews-TUI/commit/8c84b3fda9785becdcfcac5248d1d4ca5fb6fed3) add `link_dialog.rs` - [`4628784`](https://github.com/aome510/hackernews-TUI/commit/46287847cf2dfe0a9123b963add7d8e8a2f76ae3) cleanup `OnEventView` construct codes - [`da6c968`](https://github.com/aome510/hackernews-TUI/commit/da6c9681427c6c8a874c031262f1d997ccefc343) update `help_view` ### 📊 Changes **18 files changed** (+445 additions, -371 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -1) 📝 `README.md` (+53 -52) 📝 `examples/hn-tui.toml` (+15 -9) 📝 `hackernews_tui/src/client/parser.rs` (+19 -0) 📝 `hackernews_tui/src/client/query.rs` (+1 -1) 📝 `hackernews_tui/src/config/keybindings.rs` (+36 -12) 📝 `hackernews_tui/src/prelude.rs` (+1 -1) 📝 `hackernews_tui/src/utils.rs` (+0 -73) 📝 `hackernews_tui/src/view/article_view.rs` (+16 -87) 📝 `hackernews_tui/src/view/async_view.rs` (+2 -2) 📝 `hackernews_tui/src/view/comment_view.rs` (+41 -74) 📝 `hackernews_tui/src/view/error_view.rs` (+1 -1) 📝 `hackernews_tui/src/view/help_view.rs` (+46 -37) ➕ `hackernews_tui/src/view/link_dialog.rs` (+100 -0) 📝 `hackernews_tui/src/view/mod.rs` (+2 -0) 📝 `hackernews_tui/src/view/search_view.rs` (+5 -4) 📝 `hackernews_tui/src/view/story_view.rs` (+13 -17) ➕ `hackernews_tui/src/view/utils.rs` (+93 -0) </details> ### 📄 Description ## Brief description of changes - updated default shortcuts `REAMDE` - added `view::utils.rs` to separate `view` utils with general util functions defined in `utils.rs` - clean imports in files of the `view` module - implemented `LinkDialog` struct (along with traits, keymaps, etc) - changed `on_event` to `on_pre_event` to handle the events before its children receive the events - updated the behaviour of `open_article_in_browser` when the story doesn't have linked article: fallback to `open_story_in_browser` ## Breaking changes - modified the default shortcuts for link opening commands. Look into [here](https://github.com/aome510/hackernews-TUI/pull/72/files#diff-1e51105b268d755430b5c0e75bfa1f216ce542cd5bf95b761bee86043b73fd45L114-L132) for further details --- <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#88
No description provided.