[PR #767] [CLOSED] add stop-keys setting to application #1038

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

📋 Pull Request Information

Original PR: https://github.com/rivo/tview/pull/767
Author: @tinywolf3
Created: 11/9/2022
Status: Closed

Base: masterHead: add_stopkeys


📝 Commits (1)

  • 3a1dfe8 add stop-keys setting to application

📊 Changes

1 file changed (+36 additions, -2 deletions)

View changed files

📝 application.go (+36 -2)

📄 Description

Add settings to exit Application with other keys than Ctrl+C.

  • SetStopKeys(keys []tcell.Key)
  • AppendStopKey(key tcell.Key)
  • RemoveStopKey(key tcell.Key)
  • GetStopKeys()
app := tview.NewApplication()
app.AppendStopKey(tcell.KeyF12)

// ...

stops := []string{}
for _, key := range app.GetStopKeys() {
	stops = append(stops, tcell.KeyNames[key])
}
helpInfo := tview.NewTextView().
	SetText(fmt.Sprintf(" Press F1 for help, press %v to exit", strings.Join(stops, ",")))

🔄 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/767 **Author:** [@tinywolf3](https://github.com/tinywolf3) **Created:** 11/9/2022 **Status:** ❌ Closed **Base:** `master` ← **Head:** `add_stopkeys` --- ### 📝 Commits (1) - [`3a1dfe8`](https://github.com/rivo/tview/commit/3a1dfe8fa68aa7087f0eed515612b0124b731bb8) add stop-keys setting to application ### 📊 Changes **1 file changed** (+36 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `application.go` (+36 -2) </details> ### 📄 Description Add settings to exit Application with other keys than Ctrl+C. - SetStopKeys(keys []tcell.Key) - AppendStopKey(key tcell.Key) - RemoveStopKey(key tcell.Key) - GetStopKeys() ```go app := tview.NewApplication() app.AppendStopKey(tcell.KeyF12) // ... stops := []string{} for _, key := range app.GetStopKeys() { stops = append(stops, tcell.KeyNames[key]) } helpInfo := tview.NewTextView(). SetText(fmt.Sprintf(" Press F1 for help, press %v to exit", strings.Join(stops, ","))) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 01:09:08 +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#1038
No description provided.