summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/format.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2010-03-11 12:31:16 +0100
committerRobert Vollmert <rvollmert@gmx.net>2010-03-11 13:15:30 +0100
commita35bce8c2918368353ac9a736d43925a73e284df (patch)
treef976422b2f8075478b5d67a4fd092b6c4a5a74d5 /crawl-ref/source/format.cc
parent17940946e038d52e496d3f410307e1a1a8681367 (diff)
downloadcrawl-ref-a35bce8c2918368353ac9a736d43925a73e284df.tar.gz
crawl-ref-a35bce8c2918368353ac9a736d43925a73e284df.zip
Remove EOL.
We were only setting it to "\r\n" on DOS, but according to commens in #1045, DOS will translate "\n" to "\r\n" automatically for text output. Also, the DOS EOL handling was likely broken anyway looking at how a lot of the linebreaking code only considered "\n". Fixes issue #1045.
Diffstat (limited to 'crawl-ref/source/format.cc')
-rw-r--r--crawl-ref/source/format.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/crawl-ref/source/format.cc b/crawl-ref/source/format.cc
index 73831576ae..0ada949da1 100644
--- a/crawl-ref/source/format.cc
+++ b/crawl-ref/source/format.cc
@@ -40,7 +40,7 @@ int formatted_string::get_colour(const std::string &tag)
return (colour != -1? colour : LIGHTGREY);
}
-// Display a formatted string without printing literal EOL.
+// Display a formatted string without printing literal \n.
// This is important if the text is not supposed
// to clobber existing text to the right of the lines being displayed
// (some of the tutorial messages need this).
@@ -80,7 +80,7 @@ formatted_string formatted_string::parse_string(
}
// Parses a formatted string in much the same way as parse_string, but
-// handles EOL by creating a new formatted_string.
+// handles \n by creating a new formatted_string.
void formatted_string::parse_string_to_multiple(
const std::string &s,
std::vector<formatted_string> &out)
@@ -126,9 +126,9 @@ void formatted_string::parse_string1(
{
// Break the string at the end of a line, if possible, so
// that none of the broken string ends up overwritten.
- std::string::size_type bound = currs.rfind(EOL, 999);
+ std::string::size_type bound = currs.rfind("\n", 999);
if (bound != endpos)
- bound += strlen(EOL);
+ bound++;
else
bound = 999;
@@ -514,7 +514,7 @@ int count_linebreaks(const formatted_string& fs)
int count = 0;
while ( 1 )
{
- where = s.find(EOL, where);
+ where = s.find("\n", where);
if ( where == std::string::npos )
break;
else