aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-03-13 12:29:28 +0100
committerFabrice Bellingard <bellingard@gmail.com>2012-03-13 12:29:28 +0100
commit85508f6331a917a3ea34b638023adf4fbcf5ebe2 (patch)
treed16c8618f4b9766d1ad635c655080b85e336c560
parent61219df99b0c4770ccd5a819de52f1f8bb4c4e52 (diff)
downloadsonarqube-85508f6331a917a3ea34b638023adf4fbcf5ebe2.tar.gz
sonarqube-85508f6331a917a3ea34b638023adf4fbcf5ebe2.zip
SONAR-3003 Do not display last empty line in source viewer
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb
index 07f3db432f6..2a39920d0ca 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb
@@ -45,11 +45,12 @@ class Api::Utils
markdown ? Java::OrgSonarServerUi::JRubyFacade.markdownToHtml(ERB::Util.html_escape(markdown)) : ''
end
- # splits a string into an array of lines
+ # Splits a string into an array of lines
+ # For history reference:
+ # - http://jira.codehaus.org/browse/SONAR-2282 first modified the behaviour to keep the trailing lines
+ # - then http://jira.codehaus.org/browse/SONAR-3003 reverted this modification to remove potential last empty line
def self.split_newlines(input)
- # Don't limit number of returned fields and don't suppress trailing empty fields by setting second parameter to negative value.
- # See http://jira.codehaus.org/browse/SONAR-2282
- input.split(/\r?\n|\r/, -1)
+ input.split(/\r?\n|\r/)
end
def self.convert_string_to_unix_newlines(input)