[PR #343] [CLOSED] Feat: allow to override key bindings for tree actions #917

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

📋 Pull Request Information

Original PR: https://github.com/rivo/tview/pull/343
Author: @jumale
Created: 9/9/2019
Status: Closed

Base: masterHead: treeview-bind-keys


📝 Commits (1)

  • 3d2ab19 allow to override key bindings for tree actions

📊 Changes

2 files changed (+94 additions, -48 deletions)

View changed files

📝 demos/treeview/main.go (+5 -0)
📝 treeview.go (+89 -48)

📄 Description

Previous behaviour

The treeview provides some statically hardcoded key bindings for interacting with the tree. The consumers of the package are not able to re-define those bindings.

New behaviour

The treeview reads the key bindings from a configurable map.
There is a default map of keys to actions, initialised for each new TreeView.
However it's possible to redefine key bindings for each action, using method SetKeyBinding

Benefits

I want to be able to reassign the default key bindings and implement some custom tree actions for some keys which currently taken by treeview.


🔄 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/343 **Author:** [@jumale](https://github.com/jumale) **Created:** 9/9/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `treeview-bind-keys` --- ### 📝 Commits (1) - [`3d2ab19`](https://github.com/rivo/tview/commit/3d2ab191cbd9574e890abbec6ac6a478cd1a95bf) allow to override key bindings for tree actions ### 📊 Changes **2 files changed** (+94 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `demos/treeview/main.go` (+5 -0) 📝 `treeview.go` (+89 -48) </details> ### 📄 Description ## Previous behaviour The `treeview` provides some statically hardcoded key bindings for interacting with the tree. The consumers of the package are not able to re-define those bindings. ## New behaviour The `treeview` reads the key bindings from a configurable map. There is a default map of keys to actions, initialised for each new `TreeView`. However it's possible to redefine key bindings for each action, using method `SetKeyBinding` ## Benefits I want to be able to reassign the default key bindings and implement some custom tree actions for some keys which currently taken by treeview. --- <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:34 +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#917
No description provided.