[PR #757] [MERGED] Initialise Screen if SetScreen called before Run #1035

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

📋 Pull Request Information

Original PR: https://github.com/rivo/tview/pull/757
Author: @tjhowse
Created: 8/14/2022
Status: Merged
Merged: 11/13/2022
Merged by: @rivo

Base: masterHead: Fix_Screen_init


📝 Commits (3)

  • f541eaf Initialise the copy of screen in the Application struct.
  • 1a01dc6 Actual fix.
  • 583acbe Remove noise

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 application.go (+1 -0)

📄 Description

#756

The bug came from the a.screen == nil check in Application.SetScreen skipping the a.screenReplacement channel and just setting a.screen directly. This skipped the code following screen = <-a.screenReplacement meaning the new screen never got initialised.

I'm not sure if the correct fix is to init the screen if a.screen == nil as I've done in this PR, or whether it would be better to pass the new screen into the screen channel whether or not there is already a screen present.


🔄 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/757 **Author:** [@tjhowse](https://github.com/tjhowse) **Created:** 8/14/2022 **Status:** ✅ Merged **Merged:** 11/13/2022 **Merged by:** [@rivo](https://github.com/rivo) **Base:** `master` ← **Head:** `Fix_Screen_init` --- ### 📝 Commits (3) - [`f541eaf`](https://github.com/rivo/tview/commit/f541eaf9cd16f4b5f4e1bc68ea102c7afa135221) Initialise the copy of screen in the Application struct. - [`1a01dc6`](https://github.com/rivo/tview/commit/1a01dc6ba10c85d5b1c693bd6e3c460f79b93669) Actual fix. - [`583acbe`](https://github.com/rivo/tview/commit/583acbe93c0df8f391de9c56be8182b253c563e4) Remove noise ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `application.go` (+1 -0) </details> ### 📄 Description #756 The bug came from the `a.screen == nil` check in `Application.SetScreen` skipping the a.screenReplacement channel and just setting `a.screen` directly. This skipped the code following `screen = <-a.screenReplacement` meaning the new screen never got initialised. I'm not sure if the correct fix is to init the screen if `a.screen == nil` as I've done in this PR, or whether it would be better to pass the new screen into the screen channel whether or not there is already a screen present. --- <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:07 +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#1035
No description provided.