Bug 387654

Summary: Comment command should be smart enough to uncomment, too
Product: [Applications] kate Reporter: Nate Graham <nate>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: silas.lenz
Priority: NOR Keywords: usability
Version: 17.08.2   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 19.04.0

Description Nate Graham 2017-12-06 20:08:58 UTC
If you use the "Comment" command, it will comment out the current line or the selection, But if you invoke it again (i.e. from the keyboard shortcut), it will uselessly add another level of commenting. It should be smart enough to uncomment as well, so you don't need to use a separate menu item and keyboard shortcut for uncommenting.
Comment 1 Silas Lenz 2018-11-13 19:11:48 UTC
Seems like this is already implemented but only accessible via custom keyboard shortcuts or adding it to the toolbar. (For some reason there are two "Toggle comment" alternatives and only one works.)

I guess the right course of action is to remove "Comment"/"Uncomment" from the menu and replace them with a "Toggle comment", and also remove the default shortcuts for those and set CRTL+D to "Toggle comment"? Or maybe a better solution is to keep them and add CRTL+'/', since that is the default in "every other editor"?
Comment 2 Christoph Cullmann 2018-11-24 16:37:19 UTC
Git commit c7095834d282b57e66c8256ef94f4e8c14032b3c by Christoph Cullmann, on behalf of Silas Lenz.
Committed on 24/11/2018 at 16:37.
Pushed by cullmann into branch 'master'.

Expose "Toggle Comment" feature through tools menu and default shortcut

Summary:
Adds a menu item to toggle comments and adds CTRL + / as a shortcut. Also removes "Comment"/"Uncomment" menu items (but keeps the shortcuts to avoid breaking muscle memory).

{F6432040}

Test Plan: Test both old and new shortcuts and the new menu item.

Reviewers: #vdg, ngraham, #kate, #ktexteditor, cullmann

Reviewed By: #vdg, ngraham, #kate, #ktexteditor, cullmann

Subscribers: cullmann, ngraham, kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D17008

M  +2    -3    src/data/katepart5ui.rc
M  +1    -0    src/view/kateview.cpp

https://commits.kde.org/ktexteditor/c7095834d282b57e66c8256ef94f4e8c14032b3c