Disable horizontal auto-scroll when pasting text

When I paste text, the window scrolls to the end of the text. How can I disable this behavior? I don't like pressing home every time to go back to the beginning. Please check attached.

0
4 comments

I don't think it's possible, otherwise you would end up with a cursor not visible.

You can instead just press up or down.

0

I am pasting text from multiple text files for translations, and I am not sure what is the quickest way to do it, pasting text scrolls the page and that takes time.
Pressing up and down will move the cursor to the end of the previous line not to the beginning. Thx anyway.

0

As some kind of a dirty workaround, you may want to record a macro with a sequential Paste and Home actions. Afterwards, the macro can be assigned to a specific key combo.

A little bit more about it:

https://www.jetbrains.com/help/phpstorm/using-macros-in-the-editor.html 

0

The other option is to create a new "paste" concept using groovy code to do an "insert" at cursor of the past buffer.

It keeps the cursor where it is at.  I used this toolkit for goovy plugins:
https://github.com/dkandalov/live-plugin#getting-started
There HELLO WORLD example (assuming you can grab the clipboard content)

I ended up calling this code like this action: 

def actHome = actionById('EditorLineStart')
...
def savePos = editor.getCaretModel().offset
actHome.actionPerformed(anActionEvent()) // Go HOME so I don't scroll Left-Right
actHome.actionPerformed(anActionEvent()) // Go HOME so I don't scroll Left-Right // Done twice to go to REAL HOME!
def savePos2 = editor.getCaretModel().offset // save this (I can calculate the distance)
if (savePos2 > savePos) {
actHome.actionPerformed(anActionEvent())
savePos2 = editor.getCaretModel().offset // No difference
}

Effectively, if you hit LineStart, it moves you to the first character of CODE, not column 1.  Hitting it again, takes you to Column 1.

But, sometimes you are  already it the front of the line, in which case, you need to call it ONE more time to be furthest left.

And I have to do this, because once the scroll to the right is done, the viewport shifts.  And the horizontal scrollbar will NOT easily go to zero.

FINALLY, I realize this is a 2yr old post.  But I found it before I found my ultimate solution, and maybe it helps someone else!

 

 

0

Please sign in to leave a comment.