Changeset 13618
- Timestamp:
- 06/10/08 21:07:09 (5 years ago)
- Files:
-
- 1 modified
-
lang/ruby/Chemr/CHMDocument.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/Chemr/CHMDocument.rb
r2803 r13618 175 175 }.sort_by {|k,v| k.length } 176 176 177 @search_thread.kill rescue nil 177 178 if @now.length.zero? 178 r = /(#{str.split(//).map {|c| Regexp.escape(c) }.join(").*?(")})/i 179 @now.concat @index.select {|k,v| 180 k =~ r 181 }.sort_by {|k,v| 182 # 文字が前のほうに集っているほど高ランクになるように 183 m = r.match(k) 184 (0...m.size).map {|i| m.begin(i) }.inject {|p,i| p + i } 185 } 179 @now << ["Loading...", [""]] 180 @search_thread = Thread.start(str) do |str| 181 r = /(#{str.split(//).map {|c| Regexp.escape(c) }.join(").*?(")})/i 182 @now = @index.sort_by {|k,v| 183 # 文字が前のほうに集っているほど高ランクになるように 184 m = r.match(k) 185 !m ? Float::MAX : (0...m.size).map {|i| m.begin(i) }.inject {|p,i| p + i } 186 }.first(30) 187 @list.reloadData 188 end 186 189 187 190 @list.usesAlternatingRowBackgroundColors = false … … 318 321 }, 319 322 "C-\r" => Proc.new {|s| 320 @now = @chm.search(@search.stringValue).map {|title,url|323 @now = (@chm.search(@search.stringValue) || []).map {|title,url| 321 324 [title, [url]] 322 325 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)