aboutsummaryrefslogtreecommitdiff
path: root/src/utility.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility.h')
-rw-r--r--src/utility.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/utility.h b/src/utility.h
index b3816c8a7..46277cd42 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -1687,6 +1687,22 @@ inline bool string_allowed(const std::string &s, const std::string &allowed_char
}
/*
+ Forcefully wraps string into rows using \n
+ (no word wrap, used for showing paths in gui)
+*/
+inline std::string wrap_rows(const std::string &from, u32 rowlen)
+{
+ std::string to;
+ for(u32 i=0; i<from.size(); i++)
+ {
+ if(i != 0 && i%rowlen == 0)
+ to += '\n';
+ to += from[i];
+ }
+ return to;
+}
+
+/*
Some helper stuff
*/
#define MYMIN(a,b) ((a)<(b)?(a):(b))