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

implemented changes intially created by @daog1 and addresses the comm… #1016

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thomascrha
Copy link

This PR continues where #938 left off - I really want this feature - but it seems that @daog1 has abandoned the change.

This PR is a carbon copy of his changes with the addition of the suggestions made in the comments.

@cseickel cseickel changed the base branch from v2.x to main June 27, 2023 11:54
@@ -367,6 +367,8 @@ local config = {
["p"] = "paste_from_clipboard",
["c"] = "copy", -- takes text input for destination, also accepts the config.show_path and config.insert_as options
["m"] = "move", -- takes text input for destination, also accepts the config.show_path and config.insert_as options
["Y"] = "copy_path",
["gy"] = "copy_abspath",
Copy link
Contributor

Choose a reason for hiding this comment

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

The only problem here is that the commands are defined at the global level so that it applies to all sources, but it is not really a command that will work universally. It should be mapped within the filesystem and buffers commands instead.

It also makes sense to use it in the git_status source.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is correct. For example, Netman explodes when you navigate to it's Neo-tree source because I don't have these commands implemented yet. IMO they should not be "common".
Or if they are, this release needs to be slow walked as this should be considered a "Breaking Change" for 3rd party developers using Neo-tree.

That said, I really like this feature, so whatever command is decided on, I will implement it in Netman. But the fact that this causes an error on source load means this is IMO a breaking change.

Choose a reason for hiding this comment

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

Forgive my ignorance, and would you explain it in more detail,thx alot

@@ -52,6 +52,14 @@ M.copy = function(state)
cc.copy(state, redraw)
end

M.copy_path = function(state)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is needed at all because there is a

cc._add_common_commands(M)

call at the end of the file, which will add this command anyhow. This pattern of wrapping common commands is only needed when we need to alter the common command in some way, such as by adding a redraw callback.

Comment on lines +491 to +492
local pwdpath = state.path
local content = node.path
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a common command, there's no guarantee that either of these exist for all sources.

Suggested change
local pwdpath = state.path
local content = node.path
local pwdpath = state.path or ""
local content = node.path or node:get_id()

Comment on lines +35 to +42
M.copy_path = function(state)
cc.copy_path(state)
end

M.copy_abspath = function(state)
cc.copy_abspath(state)
end

Copy link
Contributor

Choose a reason for hiding this comment

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

These can be deleted as well.

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