From 97444a857e0b3e95a679fa8b58a7e108dfbf90b8 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Fri, 1 Oct 2010 15:20:15 +0200 Subject: [PATCH] highlighted search matches should be scrolled to the center of the view port --- src/ace/Editor.js | 4 ++++ src/ace/Search.js | 4 ++++ src/ace/VirtualRenderer.js | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ace/Editor.js b/src/ace/Editor.js index 2d5eabc7..6653f562 100644 --- a/src/ace/Editor.js +++ b/src/ace/Editor.js @@ -861,6 +861,10 @@ var Editor = function(renderer, doc) { } }; + this.getLastSearchOptions = function() { + return this.$search.getOptions(); + }; + this.find = function(needle, options) { this.clearSelection(); options = options || {}; diff --git a/src/ace/Search.js b/src/ace/Search.js index 0712cf53..61bdf5d2 100644 --- a/src/ace/Search.js +++ b/src/ace/Search.js @@ -32,6 +32,10 @@ Search.SELECTION = 2; oop.mixin(this.$options, options); return this; }; + + this.getOptions = function() { + return lang.copyObject(this.$options); + }; this.find = function(doc) { if (!this.$options.needle) diff --git a/src/ace/VirtualRenderer.js b/src/ace/VirtualRenderer.js index daf86c12..ca748dce 100644 --- a/src/ace/VirtualRenderer.js +++ b/src/ace/VirtualRenderer.js @@ -257,11 +257,11 @@ var VirtualRenderer = function(container, theme) { }; this.getFirstVisibleRow = function() { - return this.layerConfig.firstRow || 0; + return (this.layerConfig || {}).firstRow || 0; }; this.getLastVisibleRow = function() { - return this.layerConfig.lastRow || 0; + return (this.layerConfig || {}).lastRow || 0; }; this.onScroll = function(e) {