summaryrefslogtreecommitdiffstats
path: root/app/helpers/search_helper.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-07-18 09:46:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-07-18 09:46:20 +0000
commitbf0ddc2886f4c0b9629a36686f168051615564a9 (patch)
tree101bd920726d0fab07104884515f02af3ad1d31c /app/helpers/search_helper.rb
parent36d8f3519246898c402683a1b1575660f52de260 (diff)
downloadredmine-bf0ddc2886f4c0b9629a36686f168051615564a9.tar.gz
redmine-bf0ddc2886f4c0b9629a36686f168051615564a9.zip
Fixes artefacts in truncated search results (#3622).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2822 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/search_helper.rb')
-rw-r--r--app/helpers/search_helper.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 32ff16f67..640b5a907 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -27,8 +27,9 @@ module SearchHelper
result << '...'
break
end
+ words = words.mb_chars
if i.even?
- result << h(words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words)
+ result << h(words.length > 100 ? "#{words.slice(0..44)} ... #{words.slice(-45..-1)}" : words)
else
t = (tokens.index(words.downcase) || 0) % 4
result << content_tag('span', h(words), :class => "highlight token-#{t}")