How to stop "Comment With Line Comment" from advancing to the next line?

As the title says. When I use the shortcut, the IDE comments the current line and automatically advances to the next line, making me go back manually if I just wanted to comment that one line one time for testing.

Can I stop PyCharm from being annoying like that?

0

I too would dearly like an answer.

This also occurs when this command is used on a to uncomment a line. 

And is inconsistent e.g. does not happen when adding comment # on a blank line.

Web search finds statements about the possibly related “Intelli J Platform” https://youtrack.jetbrains.com/issue/IJPL-29536/Keep-caret-position-when-commenting-code by JetBrains sugesting that this is WAD:

“Caret is moving to make it easy to comment several adjacent lines.” 

and then saying it is fixed:

“In 2021.2 this will be configurable (Settings | Advanced Settings | Editor | [ ] Move caret down after Comment with Line Comment action)”

with a workaround that some find works and some find does not work:

“Problem still unresolved. Caret still moves below even when setting is set to OFF”

https://youtrack.jetbrains.com/issue/PY-13570/comment-with-Line-Comment-does-not-work-when-cursor-is-inside-regexp

Which may or may not apply to PyCharm.

 

1

请先登录再写评论。