Code Monkey home page Code Monkey logo

Comments (8)

math2001 avatar math2001 commented on May 30, 2024 1

Besides, is there any possibility to add cut/paste to the menu?

That's not planned. FileManager just tries to be lightweight, and I feel that if you are going to such big fancy file moves, then you should use an actual file manager, not the text editor's.

Indeed, auto_close_empty_group doesn't work for me either. I'll look into that later on

from filemanager.

math2001 avatar math2001 commented on May 30, 2024 1

Alright sweet, I'll make an other package and submit it to package control 🙂

I don't think on_hover is the most appropriate event to listen for. FileManager uses on_close (with a little on_pre_close because ST is a bit quirky sometimes), so that we do as little error checking as possible. That also comes at the cost of not being able to close the pane automatically if you drag the tab out of a group with the mouse. But if you want to do that, then you should probably use View -> Groups -> Close Group (which you probably want to add to the command palette too).

Also, it uses window.run_command('close_pane') instead of forcefully using the single layout (so if for some odd reason you have nested groups ie. 3 columns for example, it wouldn't destroy everything).

I'll close once I will have split up FileManager and AutoCloseEmptyGroup.

from filemanager.

math2001 avatar math2001 commented on May 30, 2024 1

Alright, now we just have to wait for the PR to be merged (i'll remove the feature from FileManager as soon as that happens)

from filemanager.

math2001 avatar math2001 commented on May 30, 2024 1

It's been merged! 🎉 Thank you for you help @LynnHo ♥️

I added a warning for people who did use the setting (the reason I even hit people who might have had it set to false with this warning is because maybe they just disabled because it was buggy):

def plugin_loaded():
settings = get_settings()
# this use to be a supported setting, but we dropped it. (see #27)
if settings.get("auto_close_empty_groups") is not None:
# we could remove the setting automatically, and install the
# package if it was set to true, but it'd be an extra source
# of bugs, and it doesn't take that much effort (it's a one
# time thing, so it doesn't need to be automated)
sublime.error_message(
"FileManager\n\n"
"auto_close_empty_groups is set, but this setting is no longer "
"supported.\n\n"
"Auto closing empty groups (in the layout) use to be a feature "
"of FileManager, but it has now moved to it's own package.\n\n"
"If you still want this behaviour, you can install "
"AutoCloseEmptyGroup, it's available on package control.\n\n"
"To disable this warning, unset the setting "
"auto_close_empty_groups in FileManager.sublime-settings (search "
"for Preferences: FileManager Settings in the command palette)"
)

from filemanager.

LynnHo avatar LynnHo commented on May 30, 2024 1

@math2001 Well done!

from filemanager.

math2001 avatar math2001 commented on May 30, 2024

Omg that was a very stupid and simple bug. I was checking the view's settings, instead of FileManager's settings. Just a one liner. I'll push the fix 🙂

from filemanager.

math2001 avatar math2001 commented on May 30, 2024

Actually, I just realised that it doesn't really make sense for this feature to be in FileManager. I think it should be in it's own package (something like AutoCloseEmptyGroup maybe?)

It would be a tiny package, sure, but this feature doesn't interact in any way with the rest of FileManager, and I don't think a user would expect it either (ie. think about a user uninstalling FileManager, and suddenly seeing that their empty groups don't close automatically. They certainly could want that feature without FileManager). Considering that the default value for this setting was false, this might even be the opportunity to split now.

What do you think @LynnHo ?

from filemanager.

LynnHo avatar LynnHo commented on May 30, 2024

@math2001 Thanks for fixing the bug! I totally agree that it should be an independent package. And actually, I wrote an AutoCloseEmptyGroup for myself. The code is below, (I am not very familiar with sublime coding, but it works)

class AutoCloseEmptyGroupCommand(sublime_plugin.EventListener):
    """AutoCloseEmptyGroup.

    Settings
    --------
    view_control_close_auto_close_empty_group: boolean

    """

    def on_hover(self, view, point, hover_zone):
        auto_close_empty_group = self.settings.get('view_control_close_auto_close_empty_group', False)

        if auto_close_empty_group:
            window = sublime.active_window()

            n_group = window.num_groups()
            non_empty_group_id = []
            for i in range(n_group):
                if window.sheets_in_group(i):
                    non_empty_group_id.append(i)

            if len(non_empty_group_id) == 1 and len(non_empty_group_id) < n_group:
                for s in window.sheets_in_group(non_empty_group_id[0]):
                    window.set_sheet_index(s, 0, len(window.sheets_in_group(0)))
                    window.focus_group(0)  # to avoid crash
                window.run_command('set_layout', {"cols": [0.0, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1]]})

from filemanager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.