From 6653ac6b362cf88a6b77a4e8dd3c6926885c6b5f Mon Sep 17 00:00:00 2001 From: frosch Date: Wed, 14 Nov 2012 22:50:21 +0000 Subject: (svn r24739) -Codechange: Simplify some code by using Textbuf::Assign. --- src/network/network_chat_gui.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/network/network_chat_gui.cpp') diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index af5782037..d3caed015 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -437,14 +437,11 @@ struct NetworkChatWindow : public QueryStringBaseWindow { /* Change to the found name. Add ': ' if we are at the start of the line (pretty) */ if (pre_buf == tb_buf) { - snprintf(tb->buf, this->edit_str_size, "%s: ", cur_name); + this->text.Print("%s: ", cur_name); } else { - snprintf(tb->buf, this->edit_str_size, "%s %s", pre_buf, cur_name); + this->text.Print("%s %s", pre_buf, cur_name); } - /* Update the textbuffer */ - this->text.UpdateSize(); - this->SetDirty(); free(pre_buf); return; @@ -453,12 +450,9 @@ struct NetworkChatWindow : public QueryStringBaseWindow { if (second_scan) { /* We walked all posibilities, and the user presses tab again.. revert to original text */ - strcpy(tb->buf, _chat_tab_completion_buf); + this->text.Assign(_chat_tab_completion_buf); _chat_tab_completion_active = false; - /* Update the textbuffer */ - this->text.UpdateSize(); - this->SetDirty(); } free(pre_buf); -- cgit v1.2.3-54-g00ecf