Escape number signs to prevent unwanted newlines
This commit is contained in:
parent
4c0abf49e1
commit
901f2fc817
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
*.gmk
|
*.gmk
|
||||||
*.gm81
|
*.gm81
|
||||||
|
*.gb1
|
||||||
gittogmk
|
gittogmk
|
||||||
gmktogit
|
gmktogit
|
||||||
gmksplit.jar
|
gmksplit.jar
|
||||||
|
Binary file not shown.
@ -9,16 +9,18 @@ str=argument0;
|
|||||||
logw=argument1;
|
logw=argument1;
|
||||||
loop=true;
|
loop=true;
|
||||||
|
|
||||||
|
// Escape number signs to prevent unwanted newlines
|
||||||
|
str=string_replace_all(str,"#","\#");
|
||||||
|
|
||||||
while (loop){
|
while (loop){
|
||||||
if(string_width(str)>logw){
|
if(string_width(str)>logw){
|
||||||
// The string is too long to be displayed on one line.
|
// The string is too long to be displayed on one line.
|
||||||
|
|
||||||
if(string_pos(" ",str)&&(string_width(string_copy(str,1,string_pos(" ",str)))<logw)){
|
if(string_pos(" ",str)&&(string_width(string_copy(str,1,string_pos(" ",str)))<logw)){
|
||||||
// There's a space before str exceeds the display width
|
// There's a space before str exceeds the display width
|
||||||
i=string_length(str);
|
i=string_length(str);
|
||||||
repeat(string_length(str)){
|
repeat(string_length(str)){
|
||||||
if((string_char_at(str,i)==" ")&&(string_width(string_copy(str,1,i))<logw)){
|
if((string_char_at(str,i)==" ")&&(string_width(string_copy(str,1,i))<logw)){
|
||||||
chatLog=chatLog+string_replace_all(string_copy(str,1,i-1),"#","\#")+EOL;
|
chatLog=chatLog+string_copy(str,1,i-1)+EOL;
|
||||||
str=string_delete(str,1,i);
|
str=string_delete(str,1,i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -30,7 +32,7 @@ while (loop){
|
|||||||
repeat(string_length(str)){
|
repeat(string_length(str)){
|
||||||
if(string_width(string_copy(str,1,i))<logw){
|
if(string_width(string_copy(str,1,i))<logw){
|
||||||
str=string_insert("-",str,i-1);
|
str=string_insert("-",str,i-1);
|
||||||
chatLog=chatLog+string_replace_all(string_copy(str,1,i-1),"#","\#")+EOL;
|
chatLog=chatLog+string_copy(str,1,i-1)+EOL;
|
||||||
str=string_delete(str,1,i);
|
str=string_delete(str,1,i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -40,7 +42,7 @@ while (loop){
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// The string will fit, just add it to the log.
|
// The string will fit, just add it to the log.
|
||||||
chatLog=chatLog+string_replace_all(str,"#","\#")+EOL;
|
chatLog=chatLog+str+EOL;
|
||||||
loop=false;
|
loop=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user