The color quotes mechanism now also accepts the unusual '|' as quote symbol,

so that mails I get from Mr. Wilber are shown correctly, too :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11906 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-03-18 18:19:45 +00:00
parent e4365762e6
commit a7779c5ae0
+10 -4
View File
@@ -424,6 +424,13 @@ CopyQuotes(const char *text, size_t length, char *outText, size_t &outLength)
} }
bool
is_quote_char(char c)
{
return c == '>' || c == '|';
}
/** Fills the specified text_run_array with the correct values for the /** Fills the specified text_run_array with the correct values for the
* specified text. * specified text.
* If "view" is NULL, it will assume that "line" lies on a line break, * If "view" is NULL, it will assume that "line" lies on a line break,
@@ -440,7 +447,6 @@ FillInQuoteTextRuns(BTextView *view, const char *line, int32 length, const BFont
bool begin; bool begin;
int32 pos = 0; int32 pos = 0;
int32 level = 0; int32 level = 0;
const char *quote = QUOTE;
// get index to the beginning of the current line // get index to the beginning of the current line
@@ -471,7 +477,7 @@ FillInQuoteTextRuns(BTextView *view, const char *line, int32 length, const BFont
begin = true; // if there was no text in this line, there may come more nested quotes begin = true; // if there was no text in this line, there may come more nested quotes
for (int32 i = start; i < end; i++) { for (int32 i = start; i < end; i++) {
if (text[i] == quote[0]) if (is_quote_char(text[i]))
level++; level++;
else if (text[i] != ' ' && text[i] != '\t') { else if (text[i] != ' ' && text[i] != '\t') {
begin = false; begin = false;
@@ -489,13 +495,13 @@ FillInQuoteTextRuns(BTextView *view, const char *line, int32 length, const BFont
for (int32 pos = 0; pos < length;) { for (int32 pos = 0; pos < length;) {
int32 next; int32 next;
if (begin && line[pos] == quote[0]) { if (begin && is_quote_char(line[pos])) {
while (pos < length && line[pos] != '\n') { while (pos < length && line[pos] != '\n') {
level++; level++;
bool search = true; bool search = true;
for (next = pos + 1; next < length; next++) { for (next = pos + 1; next < length; next++) {
if (search && line[next] == quote[0] if (search && is_quote_char(line[next])
|| line[next] == '\n') || line[next] == '\n')
break; break;
else if (line[next] != ' ' && line[next] != '\t') else if (line[next] != ' ' && line[next] != '\t')