Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide Note List menu text does not change #1802

Closed
josh-nz opened this issue Jan 7, 2025 · 7 comments
Closed

Hide Note List menu text does not change #1802

josh-nz opened this issue Jan 7, 2025 · 7 comments
Assignees

Comments

@josh-nz
Copy link

josh-nz commented Jan 7, 2025

Description

The text in the View menu does not update based on the visibility of the note lsit.

To Reproduce

When the note list is visible, the View menu shows the option Hide Note List.
Click this option and the note list hides.
View the menu option again - it still says Hide Note List

Expected behavior

I expect with the note list hidden, the menu text will say Show Note List.

FSNotes version

6.9.8 (651)

macOS/iOS version

15.1.1

Additional context

The Show Note List text is defined in the localization file, and the menu looks set to update to the correct resource:

https://github.com/search?q=repo%3Aglushchenko%2Ffsnotes%20%22hide%20note%20list%22&type=code

I suspect the bug is coming from isVisibleNoteList() here:

public func isVisibleNoteList() -> Bool {

The View menu option Hide Sidebar correctly toggles the menu text, and the main difference between the isVisibleSidebar() function and the isVisibleNoteList() one is that the former casts the width to an Int before comparing to zero. So perhaps the width property in isVisibleNoteList() is return a fractional double so it's not equal to zero, or some other similar double/int comparison is failing. I'm not familiar with Swift and what it does with implicit type conversions.

I suspect casting the result of:

let size = UserDefaultsManagement.horizontalOrientation
            ? vc.splitView.subviews[0].frame.height
            : vc.splitView.subviews[0].frame.width

to an Int might fix this issue. Eg:

let size = Int(UserDefaultsManagement.horizontalOrientation
            ? vc.splitView.subviews[0].frame.height
            : vc.splitView.subviews[0].frame.width)
@glushchenko
Copy link
Owner

Hi @josh-nz, unfortunately i cannot reproduce this bug. But we can try suggested trick with Int type.

Please check this build:

FSNotes.zip

@josh-nz
Copy link
Author

josh-nz commented Jan 9, 2025

No, that build does not fix the issue. I've also just tried resizing the window and the notes list and toggling the option, in case it was something to do with my window and notes list sizing. In all cases the issue is present for me.

If you'd like to me try a build with extra logging, I'd be happy to attach the logs here.

@glushchenko
Copy link
Owner

OK, next try:

FSNotes.zip

@josh-nz
Copy link
Author

josh-nz commented Jan 10, 2025

That build works. I tested at my regular window size and at near full screen (the fill screen window tiling option), and with the notes list at my normal height and non-visible (dragged the notes list bottom bar all the way to the top). In all cases the menu toggled correctly between hide and show.

Out of curiosity, what was the fix?

glushchenko added a commit that referenced this issue Jan 10, 2025
@glushchenko
Copy link
Owner

The problem is that I was testing the default configuration where the notes list is on the side. You can see the commit with the fix above.

@josh-nz
Copy link
Author

josh-nz commented Jan 11, 2025

Ah, I had totally forgotten you can choose top or side for the notes list location, otherwise I would have mentioned it. It was the very first thing I changed to make it look more like how I was used to from nvALT.

Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants