[PR #363] [MERGED] Mouse support #923

Closed
opened 2026-03-04 01:08:35 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rivo/tview/pull/363
Author: @millerlogic
Created: 11/4/2019
Status: Merged
Merged: 3/26/2020
Merged by: @rivo

Base: mouseHead: mouse-support


📝 Commits (10+)

📊 Changes

16 files changed (+547 additions, -53 deletions)

View changed files

📝 application.go (+185 -0)
📝 box.go (+51 -0)
📝 button.go (+16 -0)
📝 checkbox.go (+17 -0)
📝 demos/list/main.go (+1 -0)
📝 demos/presentation/main.go (+2 -0)
📝 dropdown.go (+99 -53)
📝 flex.go (+17 -0)
📝 form.go (+23 -0)
📝 frame.go (+15 -0)
📝 grid.go (+17 -0)
📝 inputfield.go (+14 -0)
📝 list.go (+46 -0)
📝 modal.go (+15 -0)
📝 pages.go (+19 -0)
📝 primitive.go (+10 -0)

📄 Description

Hi, this pull request adds mouse support. Here are some notes on the changes:

  • app.EnableMouse() is needed in order to enable the mouse. Mouse enabled does cause extra traffic and redrawing. Because it's disabled by default, there should be no behavior impact to existing programs.
  • Mouse enabled prevents normal selecting text in most terminals. Workaround is to use the shift key while selecting. It's the developer's decision if they want to impose this on their users.
  • Buttons, checkboxes and list items can be clicked.
  • InputField sets focus on click, it could potentially also allow you to click to a specific character position.
  • DropDown list responds to clicks, and clicking outside closes the list.
  • Clicks on TreeView and Table not implemented yet.
  • Primitives could have a new hover draw state, such as changing the background color on hover. Needs color/theming decision. (I experimented with focusing on hover, it works well but I'm not sure it's a good default)
  • Try the the presentation demo to test the mouse. You can't click to switch slides, that would be nice.

Relevant issues: #13 #361 #338 #337


🔄 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/rivo/tview/pull/363 **Author:** [@millerlogic](https://github.com/millerlogic) **Created:** 11/4/2019 **Status:** ✅ Merged **Merged:** 3/26/2020 **Merged by:** [@rivo](https://github.com/rivo) **Base:** `mouse` ← **Head:** `mouse-support` --- ### 📝 Commits (10+) - [`96875c7`](https://github.com/rivo/tview/commit/96875c75b9f927585f21b08f09841b4fea8ab4bf) Added mouse handling - [`2f4b6ad`](https://github.com/rivo/tview/commit/2f4b6ad7481e3811374dd70a3d5a0d1a1f086253) Return self - [`d725028`](https://github.com/rivo/tview/commit/d7250288e2ad0b3b67b91db2e36901b8ed42bdce) More mouse handling for primitives - [`d891191`](https://github.com/rivo/tview/commit/d891191b780e5133f3042532d465edca4863d742) Fire Selected on list item click - [`871ddc5`](https://github.com/rivo/tview/commit/871ddc57d7570779f83524095e8cd49479c2c9b3) DropDown mouse support - [`1d496ac`](https://github.com/rivo/tview/commit/1d496acc2b87f58f2f8ea09d0fbe03de1ac72b7b) Dismiss dropdown by click - [`e4d6f4f`](https://github.com/rivo/tview/commit/e4d6f4f3eec86b380a38a8c9271f35f5381702ef) Fix dropdown focus - [`93c0edc`](https://github.com/rivo/tview/commit/93c0edc4a8bdf94c565fec0d565f55a25c20c580) Get mouse actions rather than just mouse state - [`cd3c60e`](https://github.com/rivo/tview/commit/cd3c60e6d1ea916ff5c9a907d87013e50354fc7d) Refactor EventMouse - [`9598ca2`](https://github.com/rivo/tview/commit/9598ca25197aecfbe3fb91507f64725812363739) New mouse design ### 📊 Changes **16 files changed** (+547 additions, -53 deletions) <details> <summary>View changed files</summary> 📝 `application.go` (+185 -0) 📝 `box.go` (+51 -0) 📝 `button.go` (+16 -0) 📝 `checkbox.go` (+17 -0) 📝 `demos/list/main.go` (+1 -0) 📝 `demos/presentation/main.go` (+2 -0) 📝 `dropdown.go` (+99 -53) 📝 `flex.go` (+17 -0) 📝 `form.go` (+23 -0) 📝 `frame.go` (+15 -0) 📝 `grid.go` (+17 -0) 📝 `inputfield.go` (+14 -0) 📝 `list.go` (+46 -0) 📝 `modal.go` (+15 -0) 📝 `pages.go` (+19 -0) 📝 `primitive.go` (+10 -0) </details> ### 📄 Description Hi, this pull request adds mouse support. Here are some notes on the changes: * app.EnableMouse() is needed in order to enable the mouse. Mouse enabled does cause extra traffic and redrawing. Because it's disabled by default, there should be no behavior impact to existing programs. * Mouse enabled prevents normal selecting text in most terminals. Workaround is to use the shift key while selecting. It's the developer's decision if they want to impose this on their users. * Buttons, checkboxes and list items can be clicked. * InputField sets focus on click, it could potentially also allow you to click to a specific character position. * DropDown list responds to clicks, and clicking outside closes the list. * Clicks on TreeView and Table not implemented yet. * Primitives could have a new hover draw state, such as changing the background color on hover. Needs color/theming decision. (I experimented with focusing on hover, it works well but I'm not sure it's a good default) * Try the the presentation demo to test the mouse. You can't click to switch slides, that would be nice. Relevant issues: #13 #361 #338 #337 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 01:08:35 +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/tview#923
No description provided.