From 0f4bf9609cf724ade866267184cb77e052444817 Mon Sep 17 00:00:00 2001 From: Alexey Savchuk Date: Mon, 15 Jul 2024 23:21:34 +0300 Subject: [PATCH 1/2] [#1004] feat: add GetSelectedFunc method for TreeView component --- treeview.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/treeview.go b/treeview.go index c473e0f..7a17904 100644 --- a/treeview.go +++ b/treeview.go @@ -450,6 +450,12 @@ func (t *TreeView) SetSelectedFunc(handler func(node *TreeNode)) *TreeView { return t } +// GetSelectedFunc returns the function set with SetSelectedFunc() or nil +// if no such function has been set. +func (t *TreeView) GetSelectedFunc() func(node *TreeNode) { + return t.selected +} + // SetDoneFunc sets a handler which is called whenever the user presses the // Escape, Tab, or Backtab key. func (t *TreeView) SetDoneFunc(handler func(key tcell.Key)) *TreeView { From 799e99ce2215357cdeff522ab7d8041a5982cf41 Mon Sep 17 00:00:00 2001 From: Alexey Savchuk Date: Sun, 4 Aug 2024 17:00:24 +0300 Subject: [PATCH 2/2] [#1004] fix: change the method doc comment --- treeview.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/treeview.go b/treeview.go index 7a17904..d4b1967 100644 --- a/treeview.go +++ b/treeview.go @@ -450,8 +450,8 @@ func (t *TreeView) SetSelectedFunc(handler func(node *TreeNode)) *TreeView { return t } -// GetSelectedFunc returns the function set with SetSelectedFunc() or nil -// if no such function has been set. +// GetSelectedFunc returns the function set with [TreeView.SetSelectedFunc] +// or nil if no such function has been set. func (t *TreeView) GetSelectedFunc() func(node *TreeNode) { return t.selected }