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

Add "close to the left" and "close to the right" actions for editor tabs #196

Closed
wants to merge 1 commit into from

Conversation

ShadauxCat
Copy link

...mimicking similar functionality in notepad++.

…abs, mimicking similar functionality in notepad++.
@ShadauxCat
Copy link
Author

This is one of the features of notepad++ I use most often in windows environments. After searching through countless linux editors trying to find the same functionality, I finally just gave up and decided to add it myself to notepadqq.

@danieleds
Copy link
Member

I love this feature! It's extremely useful.

A few suggestions for the code:

  • instead of using a closing flag, check the index of the editor. Pseudocode of what I mean:

    void MainWindow::on_actionCloseRight_triggered() {
        ...
        int currEditorId = m_topEditorContainer->currentTabWidget()->currentIndex();
        m_topEditorContainer->forEachEditor([&](... editorId ...) {
            if (editorId <= currEditorId) {
                return true;
            }
    
            ...
        });
        ...
    }

    Similar thing for CloseLeft(). This simplifies the code and should allow you to reuse it for the two menus instead of replicating it.

  • Selecting one of those options should only close the tabs in the current tab widget (not sure if this is the behavior of Notepad++, but I think it's a clearer behavior anyway). So, instead of m_topEditorContainer->forEachEditor(), you might want to do a for loop on m_topEditorContainer->currentTabWidget().

(Regarding the second point, the "close all but this" menu is also wrong... I'll fix it asap).

Ask me anything if you need help! Looking forward for another commit :)

@ShadauxCat
Copy link
Author

Sorry for the delay on updating this pull request. Been a busy time lately. But I wanted to drop in and say I'm going to make the requested changes and will try to get a new commit in soon.

@danieleds danieleds closed this Sep 6, 2016
@danieleds danieleds reopened this Sep 6, 2016
@Teklad
Copy link
Collaborator

Teklad commented Mar 31, 2018

@danieleds or @JuBan1 can this be closed? Its at its 2 year anniversary so I don't see this getting updated by the original author at this point. If one of you guys want you can make the necessary changes and push it to the repo yourself instead if the feature is still desirable.

@ShadauxCat
Copy link
Author

@Teklad Ack! Sorry! I forgot this PR existed.... I'll try to update it soon...

@valera-rozuvan
Copy link
Contributor

valera-rozuvan commented Jan 29, 2019

@ShadauxCat Any progress?

danieleds added a commit that referenced this pull request Sep 27, 2019
…itor tabs (#196)

Co-authored-by: Daniele Di Sarli <danieleds0@gmail.com>
@danieleds
Copy link
Member

Done in ac769ea

@danieleds danieleds closed this Sep 27, 2019
@danieleds danieleds added this to the v2.0.0 milestone Sep 27, 2019
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.

None yet

4 participants