From 6e208cc4db85e2eec61c36905738da6dbb79d47b Mon Sep 17 00:00:00 2001 From: mcmartin Date: Sat, 6 Jan 2007 00:33:13 +0000 Subject: [PATCH] Fixed a text entry width problem that was nuking control template names (Fixes Bug #947) git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2643 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 2 ++ sc2/src/sc2code/setupmenu.c | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index c4d731449..f7d5fc1bc 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,6 @@ Changes towards version 0.7: +- Fixed a text entry width problem that was deleting control template + names (Bug #947) - Michael - uio cleanups, documentation - SvdB - uio path parsing fixes/improvements - SvdB - Windows UNC path support (#907) diff --git a/sc2/src/sc2code/setupmenu.c b/sc2/src/sc2code/setupmenu.c index 923c954b8..e68f51325 100644 --- a/sc2/src/sc2code/setupmenu.c +++ b/sc2/src/sc2code/setupmenu.c @@ -334,10 +334,13 @@ change_template (WIDGET_CHOICE *self, int oldval) static void rename_template (WIDGET_TEXTENTRY *self) { - strncpy (input_templates[choices[20].selected].name, self->value, WIDGET_TEXTENTRY_WIDTH); - /* TODO: This will have to change if the size of the input_templates name is changed */ - input_templates[choices[20].selected].name[WIDGET_TEXTENTRY_WIDTH-1] = 0; - + /* TODO: This will have to change if the size of the + input_templates name is changed. It would probably be nice + to track this symbolically or ensure that self->value's + buffer is always at least this big; this will require some + reworking of widgets */ + strncpy (input_templates[choices[20].selected].name, self->value, 30); + input_templates[choices[20].selected].name[29] = 0; } #define NUM_STEPS 20