File tree Expand file tree Collapse file tree
src/com/reveal/codetimemachine Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import com .github .mauricioaniche .ck .CKNumber ;
44import com .intellij .openapi .application .ApplicationManager ;
55import com .intellij .openapi .command .CommandProcessor ;
6- import com .intellij .openapi .editor .Document ;
7- import com .intellij .openapi .editor .EditorFactory ;
8- import com .intellij .openapi .editor .EditorSettings ;
6+ import com .intellij .openapi .editor .*;
97import com .intellij .openapi .editor .ex .EditorEx ;
108import com .intellij .openapi .fileEditor .FileDocumentManager ;
119import com .intellij .openapi .fileTypes .FileType ;
@@ -945,9 +943,17 @@ private void loadMainEditorWindowContent()
945943 public void run ()
946944 {
947945 mainEditorWindow .setText (content );
948- mainEditorWindow .getEditor ().getScrollingModel ().scroll (0 ,0 );
946+ //mainEditorWindow.setCaretPosition(0);
947+ if (mainEditorWindow .getEditor ()!=null )
948+ {
949+ // We scroll top after each setText(..) (that make scroll go down). But we don't like to be animated.
950+ // Calling this once in initialization of Editor doesn't work. so we call it every time before scrolling.
951+ mainEditorWindow .getEditor ().getScrollingModel ().disableAnimation ();
952+ mainEditorWindow .getEditor ().getScrollingModel ().scroll (0 , 0 );
953+ }
949954 // To solve the white screen problem (earlier, I resized the window to solve the problem)
950955 mainEditorWindow .revalidate ();
956+
951957 }
952958 });
953959
You can’t perform that action at this time.
0 commit comments