Skip to content

Conversation

@jesseduffield
Copy link
Owner

@jesseduffield jesseduffield commented Oct 3, 2022

fixes #2107

PR Description

This fixes the issue of stale content being re-rendered when flicking through the files panel. When flicking through the files panel, a different view renders directory contents compared to file contents. This meant if you went from dir A to file B to dir C you would briefly see dir A's content again as you select dir C because it first brings the directory main view to the top and then clears it and loads dir C's contents.

We could clear any views upon them no longer being at the top of the window but we'd then see a flicker as content goes to black before being replaced. Here we instead copy the content of the currently top view to the next view before moving that view to the top of the window.

An alternative approach is to instead only use one view but we've committed to having one set of keybindings per view and the view shown when viewing files had keybindings associated that allow clicking on the main view for the sake of starting a session in the staging view. We'll see if this pays off in the end or just makes things more complicated.

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go run scripts/cheatsheet/main.go generate)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • Docs (specifically docs/Config.md) have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@jesseduffield jesseduffield changed the title fix glitchy render of stale data when flicking through files and dire… fix glitchy render of stale data Oct 3, 2022
// Some views move between windows for example the commitFiles view and when cycling through
// side windows we need to know which view to give focus to for a given window
WindowViewNameMap map[string]string
WindowViewNameMap *utils.ThreadSafeMap[string, string]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had a concurrent read and write error so I'm introducing a thread safe map struct

}
}

func TestThreadSafeMapConcurrentReadWrite(t *testing.T) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hard to force a concurrency issue in a test but I did manage to get this to fail with a large enough range when testing against the vanilla map

@jesseduffield jesseduffield merged commit 3375cc1 into master Oct 3, 2022
@jesseduffield jesseduffield deleted the no-glitchy-render-to-main branch October 3, 2022 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flickering in main panel on master

2 participants