Skip to content

[Feature] Implement additional tab bar popup menu (when right click outside of tab button zones)#16561

Closed
anthonyleestark wants to merge 3 commits intonotepad-plus-plus:masterfrom
anthonyleestark:feature/tab-bar-popup-menu
Closed

[Feature] Implement additional tab bar popup menu (when right click outside of tab button zones)#16561
anthonyleestark wants to merge 3 commits intonotepad-plus-plus:masterfrom
anthonyleestark:feature/tab-bar-popup-menu

Conversation

@anthonyleestark
Copy link
Copy Markdown
Contributor

Description

I implemented a new feature that added an additional tab bar popup menu when right-clicking on the tab bar (outside of the tab buttons), similar to the one in Visual Studio.

The menu allows you to:

  1. Close or save all opening tabs.
  2. Restore recent closed file.
  3. Toggle tab bar status to change between default and vertical orientation, single-line and multi-line display.
  4. Add a new option to allow enabling/disabling "Toggle multi-line with mouse wheel", that will toggle changing between single-line and multi-line mode when scrolling up or down (I also added this option in Preferences... > Tab Bar)

Images

Additional Tab-Bar pop-up menu

Additional Tab-Bar pop-up menu

New option in Preferences... Dialog

I also modified the Preferences... dialog operation to allow automatically updating changes of this new option and related options (Vertical, Multi-line) when re-opening the dialog.
Before, the Preferences... dialog only updates all child dialogs' items on initialization, not on showing/hiding (closing and reopening only shows/hides the dialog). I guess because there are currently no options or parameters in the dialog that can be changed in the background.

New option in Preferences... Dialog

Issue

There is an existing issue related to this feature that I have mentioned in Issue #16552
I have also added a commit f3cd1ba to fix for that issue.
If you are going to merge this feature, please take a look at that issue, and tell me if you want to merge that commit as well.

@chcg chcg added the feature Feature requests and Feature commits label May 17, 2025
@donho donho self-assigned this May 29, 2025
@donho
Copy link
Copy Markdown
Member

donho commented Jun 2, 2025

Open Preferences dialog and switch to "Tab bar" section, while checking/unchecking "Show Tabs in Vertical Orientation" and/or "Show Tabs in Multi-line" (same for the context command "Toggle Multi-line with Mouse Wheel" ), the options in the Preferences dialog "Tab bar" section are not checked (or unchecked). So the added context commands make the incoherent behaviour.

Copy link
Copy Markdown
Member

@donho donho left a comment

Choose a reason for hiding this comment

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

  1. Remove "Show Tabs in Vertical Orientation", "Show Tabs in Multi-line" and "Toggle Multi-line with Mouse Wheel" commands from the context menu.
  2. Remove "Toggle Multi-line with Mouse Wheel" feature so far. It should be done in another PR, and find a way (GUI) less confusing for this feature.

@anthonyleestark anthonyleestark force-pushed the feature/tab-bar-popup-menu branch from 8a59c41 to 77b3c24 Compare June 3, 2025 04:17
@anthonyleestark
Copy link
Copy Markdown
Contributor Author

@donho

Open Preferences dialog and switch to "Tab bar" section, while checking/unchecking "Show Tabs in Vertical Orientation" and/or "Show Tabs in Multi-line" (same for the context command "Toggle Multi-line with Mouse Wheel" ), the options in the Preferences dialog "Tab bar" section are not checked (or unchecked). So the added context commands make the incoherent behaviour.

I did notice this case when I implemented the feature.
But I do believe in a principle that we shouldn't make any anonymous changes (in the background) to the Preferences window while users are making their own, so I didn't do anything about it.

Remove "Show Tabs in Vertical Orientation", "Show Tabs in Multi-line" /* ... */ commands from the context menu.

Should I add these into the same PR with the "Toggle Multi-line with Mouse Wheel" feature???

and find a way (GUI) less confusing for this feature.

I figured out these 2 solutions for this issue:

  1. If the Preferences dialog is open, the context menu will not display when right-clicking on the tab bar.
  2. Send a message to the Preferences dialog to prompt it to synchronize changes with the context menu.

Which one do you prefer???

Copy link
Copy Markdown
Member

@donho donho left a comment

Choose a reason for hiding this comment

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

Please follow the suggestion:

Comment thread PowerEditor/src/Notepad_plus.h Outdated
Comment thread PowerEditor/src/Notepad_plus.cpp Outdated
Comment thread PowerEditor/src/NppBigSwitch.cpp Outdated
Comment thread PowerEditor/src/NppBigSwitch.cpp Outdated
Comment thread PowerEditor/src/lastRecentFileList.h Outdated
Comment thread PowerEditor/src/Notepad_plus.cpp Outdated
@anthonyleestark
Copy link
Copy Markdown
Contributor Author

@donho
I've updated all the review changes and made some code modifications.

And I just found an issue:
When you have 2 split-views, if you right-click on this side of the splitter, the menu will pop up.
This also happens with the left-mouse double-clicking; it still opens a new tab even though the clicked point is not on the tab bar.
Do you think we should fix it???

Screenshot (59)

@donho
Copy link
Copy Markdown
Member

donho commented Jun 4, 2025

Indeed.
We cannot use SplitterContainer class for notification.
User can make Scintilla editor's border very wide:

image

But even with the default value 2, it can happen:

image

I have no solution for it. Even there's one, it won't be trivial.
Since the feature will introduce the bug, it won't be merged in the master.
Thank you for letting me know about this issue.

@anthonyleestark
Copy link
Copy Markdown
Contributor Author

@donho
Why don't we just keep this PR open until we figure out the solution for it???

@donho
Copy link
Copy Markdown
Member

donho commented Jun 4, 2025

For keeping my workflow as cleaner/simpler as possible.

Since the notification must come from the 2 splitterContainer, the only one solution I see is: test the right zone of splitterContainer to send the notification - it won't be trivial but you can try.
You can always do a new PR if you find the solution, I will merge it if it won't make the code more complex.

@anthonyleestark
Copy link
Copy Markdown
Contributor Author

anthonyleestark commented Nov 20, 2025

@donho
There is a missing case that I just found out now.
When clicking on the very left edge of the tab strip, it still creates a new tab.
Actually it's not a big problem, but I'll go ahead and fix it if you want.

@donho
Copy link
Copy Markdown
Member

donho commented Nov 20, 2025

I don't consider that a bug, so no fix about that will be accepted.

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

Labels

feature Feature requests and Feature commits reject

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants