r101440 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101439‎ | r101440 | r101441 >
Date:00:03, 1 November 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Added fallback to last line to getRenderedLineRange
Modified paths:
  • /trunk/parsers/wikidom/lib/hype/views/es.ContentView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/hype/views/es.ContentView.js
@@ -257,6 +257,8 @@
258258 /**
259259 * Gets the index of the rendered line a given offset is within.
260260 *
 261+ * Offsets that are out of range will always return the index of the last line.
 262+ *
261263 * @method
262264 * @param {Integer} offset Offset to get line for
263265 * @returns {Integer} Index of rendered lin offset is within
@@ -273,9 +275,11 @@
274276 /**
275277 * Gets the range of the rendered line a given offset is within.
276278 *
 279+ * Offsets that are out of range will always return the range of the last line.
 280+ *
277281 * @method
278282 * @param {Integer} offset Offset to get line for
279 - * @returns {Range}
 283+ * @returns {es.Range} Range of line offset is within
280284 */
281285 es.ContentView.prototype.getRenderedLineRange = function( offset ) {
282286 for ( var i = 0; i < this.lines.length; i++ ) {
@@ -283,7 +287,7 @@
284288 return this.lines[i].range;
285289 }
286290 }
287 - return null;
 291+ return this.lines[this.lines.length - 1].range;
288292 };
289293
290294 /**

Status & tagging log