"Scroll" atom-text-editor to end of long text


I’ve got an <atom-text-editor> tag in a modal that sometimes gets set to a value longer than it’s width and gets focused when the modal is brought up. The cursor is correctly positioned at the end of the value in the editor, but visually the editor still shows the beginning of the value until the user hits an arrow key or starts typing.

Is there any way to force the editor to visually scroll to the end of the string? I’ve had no luck searching, partially because it’s not really “scrolling” per se.


Does it work if you do editor.setCursorScreenPosition [0,10000], autoscroll: true? It should set the cursor at the end of the line (unless it’s longer than 10000 characters…) and should scroll the editor so that the cursor will become visible.


You should look at how the command-palette or tree-view packages setup their dialog’s atom-text-editor because it expand vertically when the text doesn’t fit horizontally.


That did the trick! Neat to know that it has an underlying model with useful methods to use on it.

Thanks a ton!