Remove unfinished "Label" text on New or Open

Text from unfinished "Label" tool input would appear after
creating a New image or Opening an existing one.  Mended.
Closes https://sourceforge.net/p/tuxpaint/bugs/246/

Mostly by Pere.
This commit is contained in:
Bill Kendrick 2023-01-23 22:04:00 -08:00
parent 2e69c51bdb
commit bf7e8897d6
2 changed files with 24 additions and 2 deletions

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
June 14, 2002 - January 19, 2023
June 14, 2002 - January 23, 2023
*/
#include "platform.h"
@ -18330,6 +18330,14 @@ static int do_open(void)
label_node_to_edit = NULL;
have_to_rec_label_node = FALSE;
/* Clean stale text */
if (texttool_len > 0)
{
texttool_str[0] = L'\0';
texttool_len = 0;
cursor_textwidth = 0;
}
SDL_FillRect(label, NULL, SDL_MapRGBA(label->format, 0, 0, 0, 0));
/* Figure out filename: */
@ -23760,6 +23768,14 @@ static int do_new_dialog(void)
highlighted_label_node = label_node_to_edit = NULL;
have_to_rec_label_node = FALSE;
/* Clean stale text */
if (texttool_len > 0)
{
texttool_str[0] = L'\0';
texttool_len = 0;
cursor_textwidth = 0;
}
if (which >= first_starter
&& (first_template == -1 || which < first_template)
&& (!new_colors_last || which < first_color))