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

duplicate line/selection up/down does not work with selections #84

Closed
Naatan opened this Issue Mar 27, 2015 · 25 comments

Comments

Projects
None yet
6 participants
@Naatan
Member

Naatan commented Mar 27, 2015

It always duplicates the entire line.

@Naatan Naatan added the Type: Bug label Mar 27, 2015

@Naatan Naatan added this to the 9.1 milestone Mar 27, 2015

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Mar 31, 2015

This is closed, but what exacly was the fix?
If it is fixed, is there a way to get a nightly or something that includes this fix? This is a feature I use a lot (didn't even realize how much I used it until I upgraded from 8.5 and it quit working).

@cgchoffman

This comment has been minimized.

Member

cgchoffman commented Mar 31, 2015

I think it got closed by accident? I'm not sure. Naatan? I'm not actually able to reproduce this.

  • Select a line
  • Ctrl + shift + up[down]

Duplicates my current selected line as expected. What platform are you on Aaron?

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Mar 31, 2015

I'm on Ubuntu.

ctrl+shift+up/down does nothing. Looking at the key bindings, I don't see those linked to anything. Maybe that's because it imported my settings from Komodo 8?

I added the key binding of ctrl+d (pretty standard for "duplicate" in other programs) for "Editor: Duplicate Line/Selection Down" and it works for duplicating a line, but if I have a text selection it still just duplicates the line.

@cgchoffman

This comment has been minimized.

Member

cgchoffman commented Mar 31, 2015

My mistake. I was SELECTING an entire LINE rather than just a portion. Duplicating a selection is not working for me, unless it's an entire line. Sorry for the confusion.

@Defman21

This comment has been minimized.

Contributor

Defman21 commented Mar 31, 2015

Duplicate a selection works fine if you select more than one line. If you just select a piece of string - Komodo will duplicate the entire line. But I don't understand how Komodo should duplicate only a portion of the line. Can you guys say what you want to see?

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Mar 31, 2015

It should go before or after (left or right, based on the user's text direction). Just like it did in Komodo 8 with "Editor: Duplicate Line or Selection" (but I guess adding in the before/after option)

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Mar 31, 2015

This has been long standing functionality.

Also, I'm not sure if it was my own bindings or default bindings that set it to CTRL+D. If it was mine, no big deal I'll just set them again. If it was default, I'm curious why that keybinding was repurposed.
It looks like, at least in Komodo 8, CTRL+D did not default to this, so that's not an issue.

@Naatan

This comment has been minimized.

Member

Naatan commented Apr 1, 2015

This isnt closed, the issue this bug is referencing got closed. Github UX can be a bit weird sometimes.

@Naatan Naatan added Type: Enhancement and removed Type: Bug labels Apr 1, 2015

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Apr 1, 2015

Yeah, sorry, I saw that after cgchoffman's reply.

However, the change from bug to enhancement doesn't seem right. This is a regression from KomodoIDE 8 to 9.

@Naatan

This comment has been minimized.

Member

Naatan commented Apr 1, 2015

Duplicate up/down didnt exist in Komodo 8, so it is definitely not a regression :) It sounds like you may be confusing this with another feature?

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Apr 1, 2015

You had "Editor: Duplicate Line or Selection" which has been REPLACED with "Editor: Duplicate Line/Selection Down" and "Editor: Duplicate Line/Selection Up". I would consider it a regression because the old method worked for this but was removed in favor of these new ones, which don't work for a partial-line selection. At least I'm pretty sure it was removed as I don't see the original one anywhere, and my previous keybinding for it was free even though my other keybindings were imported.

@cgchoffman

This comment has been minimized.

Member

cgchoffman commented Apr 2, 2015

Ctrl+D is bound to cmd_addNextWordToCaretSet and was added in Komodo 8.5
You can get the Ctrl+D functionality back by adding a macro with the following code in it

//grab the editor scimoz object
var scimoz = ko.views.manager.currentView.scimoz;
// now duplicate the selection
sicmoz.selectionDuplicate();

It won't be identical I'm sure but should work, let us know. You can then set the properties > Keybindings of the macro to Ctrl+D. That should do for a workaround for now.

Looks like we may need to revisit the implementation during Komodo 9 development and/or bring back the original code to be included as well as the new.

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Apr 7, 2015

The macro works as expected, with one minor fix. There's a typo, sicmoz should me scimoz in the selectionDuplicate line.

//grab the editor scimoz object
var scimoz = ko.views.manager.currentView.scimoz;
// now duplicate the selection
scimoz.selectionDuplicate();
@cgchoffman

This comment has been minimized.

Member

cgchoffman commented Apr 7, 2015

Yep, that would probably break it 💃

@Naatan Naatan modified the milestones: 9.1, 9.1.1, 9.2 May 19, 2015

@Naatan Naatan modified the milestones: 9.2, 9.2.1 Jun 23, 2015

@Naatan Naatan modified the milestones: 9.2, 9.2.1, 9.3 Jun 23, 2015

@thybzi

This comment has been minimized.

thybzi commented Sep 24, 2015

Is there any chance to modify a macro suggested by @cgchoffman and @aaroncampbell to function it a little bit different way: duplicated text should appear before (not after) selected text?

It would be perfectly the same way as Duplicate Line/Selection worked before, and as it works in WebStorm, NuSphere etc.

@mitchell-as mitchell-as modified the milestones: 9.3.1, 9.3 Oct 5, 2015

@Naatan Naatan modified the milestones: 10.0, 9.3.1 Oct 15, 2015

@cgchoffman

This comment has been minimized.

Member

cgchoffman commented Nov 25, 2015

Is there any chance to modify a macro suggested by @cgchoffman and @aaroncampbell to function it a little bit different way: duplicated text should appear before (not after) selected text?

@thybzi please open a forum post for this http://forum.komodoide.com/

@mitchell-as

This comment has been minimized.

Member

mitchell-as commented Nov 25, 2015

Actually, the fix I committed does this :) You can reference it if you want to create such a macro. It just involves moving the selection after duplicating the selection.

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Mar 30, 2016

Is there something preventing this from going into the 9.3 branch? It's really my biggest frustration with KomodoIDE now, and the fix seems to be here but hasn't been made available yet.

@mitchell-as

This comment has been minimized.

Member

mitchell-as commented Mar 30, 2016

This cannot go into 9.3.x because it was tagged as an enhancement and we cannot put enhancements into bugfix releases. Sorry :(

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Mar 30, 2016

I would argue that this isn't an enhancement but a fix for a regression (as I mentioned in previous comments )

You had "Editor: Duplicate Line or Selection" which has been REPLACED with "Editor: Duplicate Line/Selection Down" and "Editor: Duplicate Line/Selection Up". I would consider it a regression because the old method worked for this but was removed in favor of these new ones, which don't work for a partial-line selection.

@cgchoffman

This comment has been minimized.

Member

cgchoffman commented Mar 30, 2016

Is there something preventing this from going into the 9.3 branch?

There is no fix. There is nothing to go in yet. Wasn't there a workaround provided through a macro above? Though thats not a final solution, it reduces it's priority relative to other issues that are more severe and have no workaround.

I think there is some confusion here as well. The functionality that was in Komodo 8 is no longer in Komodo 9. The command was removed in favour of Duplicate Line/select up/down. @aaroncampbell Even if this is fixed to work with selections, it won't do what you expect (if you expect the functionality from Komodo 8). You have to use the macro above now.

Having said that, the name of the command implies that the intended functionality of the command is broken so I agree that this is a bug, not an enhancement.

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Mar 30, 2016

Well, this bug is currently closed, and was closed by a commit that supposedly fixed it (6e93df9). It looks like the commit was only in the master branch though, and not the 9.3 branch. Is there a place that explains how to modify that file locally and test it? I'd be happy to test, but I'm not sure how to generate the .pyo file from the modified .py file, and I think the .pyo file is what Komodo IDE actually uses (sorry, I'm not super familiar with Python).

@cgchoffman

This comment has been minimized.

Member

cgchoffman commented Mar 31, 2016

@aaroncampbell I missed that commit. Thanks for pointing that out. Just edit the .py file. A new .pyo file should be generated automatically when you run Komodo again. To be sure, you can delete the .pyo file.

@aaroncampbell

This comment has been minimized.

aaroncampbell commented Mar 31, 2016

The actual diff didn't apply cleanly for me because the file has changed (although I'm honestly not sure if they is because it's the 9.3 branch or if it's because I'm on Komodo IDE vs Komodo Edit), but it was easy enough to find the lines in question and make the changes. The change works EXACTLY how I had expected/hoped. Specifically, if your cursor is on a line it duplicates that line, if you have multiple lines selected it duplicates all of them, and if you have part of a line selected it duplicates only the selection.

Thank you so much @cgchoffman and @mitchell-as

@cgchoffman

This comment has been minimized.

Member

cgchoffman commented Mar 31, 2016

Not sure why the patch didn't apply but it's not because it's for IDE. You wouldn't have access to that patch. That's great to hear that it's working for you though!

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