diff --git a/NEWS b/NEWS index fd7cdd1..293a4e6 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -1.4.12: July ??, 2008: +1.4.12: July 7, 2008: * Fixed a bug in which tab/shift-tab for indending/outdenting nested lists no longer worked. Also made it work in IE as well (which it never has). * controller.Root.guide() now accepts an optional note_id parameter. @@ -7,6 +7,8 @@ to a race condition between the link info pulldown's onblur/onchange handler and the suggestion onclick handler, both of which tried to update the link, title, and summary at about the same time. + * Possibly fixed a bug in which the displayed suggestions sometimes did not + reflect the most recent characters typed. 1.4.11: June 29, 2008: * Fixed bug in which bolding of suggest-as-you-type search text was case diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 6bb1b68..b36a806 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -3450,6 +3450,7 @@ function Suggest_pulldown( wiki, notebook_id, invoker, anchor, relative_to, sear anchor.pulldown = this; this.anchor = anchor; this.previous_search_text = ""; + this.sequence_number = 0; Pulldown.call( this, wiki, notebook_id, "suggest_pulldown", anchor, relative_to ); @@ -3479,12 +3480,21 @@ Suggest_pulldown.prototype.update_suggestions = function ( search_text ) { var self = this; this.previous_search_text = search_text; + this.sequence_number += 1; + var sequence_number = this.sequence_number; this.invoker.invoke( "/notebooks/search_titles", "GET", { "notebook_id": this.notebook_id, "search_text": search_text }, - function( result ) { self.display_suggestions( result, search_text ); } + function( result ) { + // if the sequence number is not what we expect, then this must not be most recent suggests + // update, so bail without displaying the result + if ( self.sequence_number != sequence_number ) + return; + + self.display_suggestions( result, search_text ); + } ); }