diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -267,7 +267,7 @@ public: } this->afilter = CS_ALPHANUMERAL; - InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 240); + InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size); this->CreateNestedTree(desc, true); if (mode == SLD_LOAD_GAME) this->GetWidget(SLWW_CONTENT_DOWNLOAD_SEL)->SetDisplayedPlane(SZSP_HORIZONTAL); diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -356,7 +356,7 @@ struct GenerateLandscapeWindow : public /* snprintf() always outputs trailing '\0', so whole buffer can be used */ snprintf(this->edit_str_buf, this->edit_str_size, "%u", _settings_newgame.game_creation.generation_seed); - InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 120); + InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size); this->caption = STR_NULL; this->afilter = CS_NUMERAL; diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -1159,13 +1159,10 @@ bool MoveTextBufferPos(Textbuf *tb, int * @param tb Textbuf type which is getting initialized * @param buf the buffer that will be holding the data for input * @param max_bytes maximum size in bytes, including terminating '\0' - * @param max_pixels maximum length in pixels of this buffer. If reached, buffer - * cannot grow, even if maxsize would allow because there is space. Width - * of zero '0' means the buffer is only restricted by maxsize */ -void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_pixels) +void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes) { - InitializeTextBuffer(tb, buf, max_bytes, max_bytes, max_pixels); + InitializeTextBuffer(tb, buf, max_bytes, max_bytes); } /** @@ -1175,11 +1172,8 @@ void InitializeTextBuffer(Textbuf *tb, c * @param buf the buffer that will be holding the data for input * @param max_bytes maximum size in bytes, including terminating '\0' * @param max_chars maximum size in chars, including terminating '\0' - * @param max_pixels maximum length in pixels of this buffer. If reached, buffer - * cannot grow, even if maxsize would allow because there is space. Width - * of zero '0' means the buffer is only restricted by maxsize */ -void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars, uint16 max_pixels) +void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars) { assert(max_bytes != 0); assert(max_chars != 0); @@ -1187,7 +1181,7 @@ void InitializeTextBuffer(Textbuf *tb, c tb->buf = buf; tb->max_bytes = max_bytes; tb->max_chars = max_chars; - tb->max_pixels = max_pixels; + tb->max_pixels = 0; tb->caret = true; UpdateTextBufferSize(tb); } @@ -1382,7 +1376,7 @@ struct QueryStringWindow : public QueryS this->caption = caption; this->afilter = afilter; this->flags = flags; - InitializeTextBuffer(&this->text, this->edit_str_buf, max_bytes, max_chars, 0); + InitializeTextBuffer(&this->text, this->edit_str_buf, max_bytes, max_chars); this->InitNested(desc); diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -510,7 +510,6 @@ struct NewGRFWindow : public QueryString typedef GUIList GUIGRFConfigList; static const uint EDITBOX_MAX_SIZE = 50; - static const uint EDITBOX_MAX_LENGTH = 300; static Listing last_sorting; ///< Default sorting of #GUIGRFConfigList. static Filtering last_filtering; ///< Default filtering of #GUIGRFConfigList. @@ -556,7 +555,7 @@ struct NewGRFWindow : public QueryString this->GetWidget(SNGRFS_SHOW_APPLY)->SetDisplayedPlane(this->editable ? 0 : SZSP_HORIZONTAL); this->FinishInitNested(desc); - InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, EDITBOX_MAX_LENGTH); + InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size); this->SetFocusedWidget(SNGRFS_FILTER); this->avails.SetListing(this->last_sorting); diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -155,7 +155,7 @@ struct SignListWindow : QueryStringBaseW /* Initialize the text edit widget */ this->afilter = CS_ALPHANUMERAL; - InitializeTextBuffer(&this->text, this->edit_str_buf, MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS, 0); + InitializeTextBuffer(&this->text, this->edit_str_buf, MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS); ClearFilterTextWidget(); /* Initialize the filtering variables */ @@ -502,7 +502,7 @@ struct SignWindow : QueryStringBaseWindo *last_of = '\0'; this->cur_sign = si->index; - InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, this->max_chars, 0); + InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, this->max_chars); this->SetWidgetDirty(QUERY_EDIT_SIGN_WIDGET_TEXT); this->SetFocusedWidget(QUERY_EDIT_SIGN_WIDGET_TEXT); diff --git a/src/textbuf_gui.h b/src/textbuf_gui.h --- a/src/textbuf_gui.h +++ b/src/textbuf_gui.h @@ -38,8 +38,8 @@ bool DeleteTextBufferChar(Textbuf *tb, i bool InsertTextBufferChar(Textbuf *tb, uint32 key); bool InsertTextBufferClipboard(Textbuf *tb); bool MoveTextBufferPos(Textbuf *tb, int navmode); -void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_pixels); -void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars, uint16 max_pixels); +void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes); +void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars); void UpdateTextBufferSize(Textbuf *tb); /** Flags used in ShowQueryString() call */ diff --git a/src/town_gui.cpp b/src/town_gui.cpp --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -1030,7 +1030,7 @@ public: params(_settings_game.game_creation.town_name) { this->InitNested(desc, window_number); - InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, this->max_chars, 0); + InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, this->max_chars); this->RandomTownName(); this->UpdateButtons(true); }