Skip to content

Commit 5c24dd1

Browse files
committed
Merge pull request adobe#1357 from adobe/randy/code-hints-scroll
Good catch. Merging...
2 parents 375fe35 + 77e45c4 commit 5c24dd1

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/editor/CodeHintManager.js

+5-12
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ define(function (require, exports, module) {
5454

5555
this.opened = false;
5656
this.selectedIndex = -1;
57-
this.itemsPerPage = -1;
5857
this.editor = null;
5958

6059
this.$hintMenu = $("<li class='dropdown codehint-menu'></li>");
@@ -323,27 +322,21 @@ define(function (require, exports, module) {
323322
* @return {number}
324323
*/
325324
CodeHintList.prototype.getItemsPerPage = function () {
326-
if (this.itemsPerPage > 0) {
327-
return this.itemsPerPage;
328-
}
329-
330-
// default
331-
this.itemsPerPage = 1;
332-
333-
var $items = this.$hintMenu.find("li"),
325+
var itemsPerPage = 1,
326+
$items = this.$hintMenu.find("li"),
334327
$view = this.$hintMenu.find("ul.dropdown-menu"),
335328
itemHeight;
336329

337330
if ($items.length !== 0) {
338331
itemHeight = $($items[0]).height();
339332
if (itemHeight) {
340333
// round down to integer value
341-
this.itemsPerPage = Math.floor($view.height() / itemHeight);
342-
this.itemsPerPage = Math.max(1, Math.min(this.itemsPerPage, $items.length));
334+
itemsPerPage = Math.floor($view.height() / itemHeight);
335+
itemsPerPage = Math.max(1, Math.min(itemsPerPage, $items.length));
343336
}
344337
}
345338

346-
return this.itemsPerPage;
339+
return itemsPerPage;
347340
};
348341

349342
// HintList is a singleton for now. Todo: Figure out broader strategy for hint list across editors

0 commit comments

Comments
 (0)