File diff r16810:f0da6e4feb6f → r16811:848f3da56fa1
src/misc_gui.cpp
Show inline comments
 
@@ -1311,12 +1311,18 @@ struct QueryStringWindow : public QueryS
 
	QueryStringWindow(StringID str, StringID caption, uint max_bytes, uint max_chars, uint max_pixels, const WindowDesc *desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) :
 
			QueryStringBaseWindow(max_bytes, max_chars)
 
	{
 
		GetString(this->edit_str_buf, str, &this->edit_str_buf[max_bytes - 1]);
 
		str_validate(this->edit_str_buf, &this->edit_str_buf[max_bytes - 1], false, true);
 

	
 
		/* Make sure the name isn't too long for the text buffer in the number of
 
		 * characters (not bytes). max_chars also counts the '\0' characters. */
 
		while (Utf8StringLength(this->edit_str_buf) + 1 > max_chars) {
 
			*Utf8PrevChar(this->edit_str_buf + strlen(this->edit_str_buf)) = '\0';
 
		}
 

	
 
		if ((flags & QSF_ACCEPT_UNCHANGED) == 0) this->orig = strdup(this->edit_str_buf);
 

	
 
		this->caption = caption;
 
		this->afilter = afilter;
 
		this->flags = flags;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, max_bytes, max_chars, max_pixels);