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

@ -7,7 +7,7 @@ Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/ https://tuxpaint.org/
2022.January.21 (0.9.29) 2022.January.23 (0.9.29)
* Improvements to "Stamp" tool: * Improvements to "Stamp" tool:
----------------------------- -----------------------------
* Stamps may now be rotated. * Stamps may now be rotated.
@ -150,6 +150,12 @@ https://tuxpaint.org/
in zoom(). [Note: That should be replaced with an SDL2_gfx call!] in zoom(). [Note: That should be replaced with an SDL2_gfx call!]
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>
* 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/
Pere Pujal i Carabantes <perepujal@gmail.com>
and Bill Kendrick <bill@newbreedsoftware.com>
* Ports & Building: * Ports & Building:
----------------- -----------------
* Processed PNG images through `pngout` to increase some compression * Processed PNG images through `pngout` to increase some compression

View file

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