void () { initText("<caret>" + StringUtil.repeat("abc", 100)); int scrollOffBefore = getEditor().getSettings().getHorizontalScrollOffset(); getEditor().getSettings().setHorizontalScrollOffset(5); int spaceWidth = EditorUtil.getSpaceWidth(Font.PLAIN, getEditor()); EditorTestUtil.setEditorVisibleSize(getEditor(), 15, 2); // test for right scroll offset for (int i = 0; i < 49; ++i) { right(); } assertEquals(39 * spaceWidth, getEditor().getScrollingModel().getHorizontalScrollOffset()); // test for left scroll offset for (int i = 0; i < 20; ++i) { left(); } assertEquals(24 * spaceWidth, getEditor().getScrollingModel().getHorizontalScrollOffset()); getEditor().getSettings().setHorizontalScrollOffset(scrollOffBefore); }