How to scrollToCursorPosition in bottomPanel for a TextEditor


#1

I write a package for open new file content in bottomPanel.
I create a TextEditor manually like

buffer = new TextBuffer('')
    @findView = new TextEditor(_.extend({buffer, registerEditor: true}, {}))
    @goGrammer ?= atom.grammars.grammarForScopeName("source.go")
    @findView.setGrammar(@goGrammer)
    #@findView = atom.views.getView(textEditor)

    @findPanel = atom.workspace.addBottomPanel(item: @findView, visible: false, className: 'tool-panel panel-bottom godef')

....
@findView.buffer.setText(data)
@findView.setCursorBufferPosition?([options.initialLine, options.initialColumn])
@findView.scrollToCursorPosition()

@findView.scrollToCursorPosition() is not working for me.
How can I do?


#2

Sounds maybe like the ScrollView does not scroll problem?


#3

This issue sounds like scrollbar not display.
my issue is scrollToCursorPosition() is working fine in normal TextEditor but not wokring in bottom panel


#4

Are you sure the atom-text-editor in the bottom panel can scroll?
I mean, the text editor should take just the size of the panel so that its own scroll view can operate.


#5

I’m not sure. atom-text-editor can scroll in bottom panel using mouse wheel. So, I want to find some way to scroll the editor through the API


Scrolling the text editor in bottom pane and getting line height
#6

The thing is that you can be deceived in believing the editor scrolls while in fact its the pane that scrolls. I’ll try to reproduce that myself later.