diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf
index 1cfc13923e..068a1cdc46 100644
--- a/addons/interact_menu/functions/fnc_renderIcon.sqf
+++ b/addons/interact_menu/functions/fnc_renderIcon.sqf
@@ -35,7 +35,7 @@ GVAR(iconCount) = GVAR(iconCount) + 1;
if(_icon == "") then {
_icon = DEFAULT_ICON;
};
-_text = format ["![]()
%4", _icon, _color, _color, _text];
+_text = format ["![]()
%4", _icon, _color, _color, "ace_breakLine" callExtension _text];
_ctrl ctrlSetStructuredText (parseText _text);
_ctrl ctrlSetPosition [(_sPos select 0)-(0.125*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.25*SafeZoneW, 0.1*SafeZoneW];
//_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1];
diff --git a/extensions/breakLine/ace_breakLine.cpp b/extensions/breakLine/ace_breakLine.cpp
index f74eabdfc2..74a32cc66d 100644
--- a/extensions/breakLine/ace_breakLine.cpp
+++ b/extensions/breakLine/ace_breakLine.cpp
@@ -17,7 +17,7 @@
#include
#include
-#define MAXCHARACTERS 11
+#define MAXCHARACTERS 14
static char version[] = "1.0";
@@ -30,23 +30,32 @@ std::vector splitString(std::string input) {
std::string token;
std::vector output;
- while (std::getline(ss, token, ',')) {
+ while (std::getline(ss, token, ' ')) {
output.push_back(token);
}
return output;
}
-std::string addLineBreaks(std::string input) {
+std::string addLineBreaks(const std::vector &words) {
+
std::stringstream sstream;
int numChar = 0;
- for ( int i = 0 ; i < input.length(); i++) {
- if (numChar >= MAXCHARACTERS && input[i] == ' ') {
- sstream << "
";//"<br/>";
- numChar = 0;
+ int i = 0;
+ while (i < words.size()) {
+ if (numChar == 0) {
+ sstream << words[i];
+ numChar += words[i].size();
+ i++;
} else {
- sstream << input[i];
- numChar++;
+ if (numChar + 1 + words[i].size() > MAXCHARACTERS) {
+ sstream << "
";
+ numChar = 0;
+ } else {
+ sstream << " " << words[i];
+ numChar += 1 + words[i].size();
+ i++;
+ }
}
}
return sstream.str();
@@ -57,13 +66,12 @@ std::string addLineBreaks(std::string input) {
#pragma warning( disable : 4996 )
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
+ //strncpy(output, function, outputSize);
+
if (!strcmp(function, "version")) {
strncpy(output, version, outputSize);
} else {
- std::vector argStrings = splitString(function);
- std::string originalString = argStrings[0];
-
- strcpy(output, addLineBreaks(originalString).c_str());
+ strcpy(output, addLineBreaks(splitString(function)).c_str());
output[outputSize - 1] = '\0';
}
}