Escaping notes in the readme and a check for ConvertNewLines

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2320 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-03-17 13:46:13 +00:00
parent 1c6dc531e6
commit 35557a6ca0
3 changed files with 39 additions and 34 deletions

View file

@ -32,34 +32,6 @@ char *STRDUP(const char *c)
return t;
}
void ConvertNewLines(char *str) {
char *p1, *p2;
for (p1=p2=str; *p1; p1++, p2++) {
if (*p1 == '\\') {
switch (p1[1]) {
case 'n':
*p2 = '\n';
break;
case 'r':
*p2 = '\r';
break;
case 't':
*p2 = '\t';
break;
case '\\':
*p2 = '\\';
break;
default:
p1--;
p2--;
break;
}
p1++;
}
else *p2 = *p1;
}
*p2 = 0;
}
#define FIELD_LABEL (1)
#define FIELD_ICON (2)
@ -101,6 +73,8 @@ struct TableEntry {
int LookupToken(TableEntry*, char*);
int LookupTokens(TableEntry*, char*);
void ConvertNewLines(char *str);
struct FieldType {
char *pszText;
char *pszState;
@ -377,12 +351,13 @@ bool SaveSettings(void) {
return true;
}
#define BROWSE_WIDTH 15
void AddBrowseButtons() {
// this function loops through all the controls and if a filerequest or dirrequest
// control is found, then it adds the corresponding browse button.
// NOTE: this also resizes the text box created to make room for the button.
int nIdx;
int nWidth = 15;
FieldType *pNewField;
for (nIdx = nNumFields - 1; nIdx >= 0; nIdx--) {
@ -403,7 +378,7 @@ void AddBrowseButtons() {
//pNewField->pszValidateText = NULL;
pNewField->rect.right = pFields[nIdx].rect.right;
pNewField->rect.left = pNewField->rect.right - nWidth;
pNewField->rect.left = pNewField->rect.right - BROWSE_WIDTH;
pNewField->rect.bottom = pFields[nIdx].rect.bottom;
pNewField->rect.top = pFields[nIdx].rect.top;
@ -514,7 +489,7 @@ bool ReadSettings(void) {
// Label Text - convert newline
if (pFields[nIdx].nType == FIELD_LABEL && pFields[nIdx].pszText) {
if (pFields[nIdx].nType == FIELD_LABEL) {
ConvertNewLines(pFields[nIdx].pszText);
}
@ -1123,3 +1098,33 @@ int LookupTokens(TableEntry* psTable_, char* pszTokens_)
}
return n;
}
void ConvertNewLines(char *str) {
char *p1, *p2;
if (!str) return;
for (p1=p2=str; *p1; p1++, p2++) {
if (*p1 == '\\') {
switch (p1[1]) {
case 'n':
*p2 = '\n';
break;
case 'r':
*p2 = '\r';
break;
case 't':
*p2 = '\t';
break;
case '\\':
*p2 = '\\';
break;
default:
p1--;
p2--;
break;
}
p1++;
}
else *p2 = *p1;
}
*p2 = 0;
}

View file

@ -235,7 +235,7 @@ numbers from 1 to NumFields. Each Field section can contain the following values
<td class="lefttable"><span class="italic">(optional)</span></td>
<td class="righttable">Specifies the caption of a label, checkbox, or radio button control.
For icon and bitmaps control this specifies the path to the image.<br /><br />
<span class="bold">Note:</span> For labels, \r\n will be converted to a newline.
<span class="bold">Note:</span> For labels, \r\n will be converted to a newline. To use a back-slash in your text you have to escape it using another back-slash - \\.
</td></tr>
<tr>
<td class="lefttable"><span class="bold">State</span></td>
@ -277,10 +277,10 @@ numbers from 1 to NumFields. Each Field section can contain the following values
<tr>
<td class="lefttable"><span class="bold">ValidateText</span></td>
<td class="lefttable"><span class="italic">(optional)</span></td>
<td class="righttable">If a particular field fails the test for
<td class="righttable">If the field fails the test for
"<span class="italic">MinLen</span>" or "<span class="italic">MaxLen</span>",
a messagebox will be displayed with this text.<br /><br /><span class="bold">
Note:</span> \r\n will be converted to a newline.</td></tr>
Note:</span> \r\n will be converted to a newline, two back-slashes will be converted to one - \\.</td></tr>
<tr>
<td class="lefttable"><span class="bold">Left<br />Right<br />Top<br />Bottom</span></td>
<td class="lefttable"><span class="italic">(required)</span></td>

Binary file not shown.