diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 5d6d5b4b4..1300b330a 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -7,7 +7,7 @@ Various contributors (see below, and AUTHORS.txt) https://tuxpaint.org/ -2022.January.21 (0.9.29) +2022.January.23 (0.9.29) * Improvements to "Stamp" tool: ----------------------------- * Stamps may now be rotated. @@ -150,6 +150,12 @@ https://tuxpaint.org/ in zoom(). [Note: That should be replaced with an SDL2_gfx call!] Bill Kendrick + * 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 + and Bill Kendrick + * Ports & Building: ----------------- * Processed PNG images through `pngout` to increase some compression diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 5787f7a91..8953bbaff 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -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))