From 337fcd2d2c779067859ebe40cc74c05c6b284e2c Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Tue, 17 Nov 2009 19:39:01 +0000 Subject: [PATCH] STR #2292: fixed issue typing a minus in Fl_Int_Input when all text is selected. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@6940 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 1 + src/Fl_Input.cxx | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index cc5d390c8..7446bf671 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ CHANGES IN FLTK 1.1.10 + - Fixed selection bug in Fl_Int_Input (STR #2292) - Fixed character set conversion functions (STR #2268) - Fixed image lib configure and fltk-config issues by backporting the image lib and zlib configure code from FLTK 1.3 (STR #2203) diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index ba10c0694..33fb9d168 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -119,13 +119,16 @@ int Fl_Input::handle_key() { } #endif // HAVE_LOCALECONV + // find the insert position + int ip = position()= '0' && ascii <= '9') || - (position()==1 && index(0)=='0' && (ascii=='x' || ascii == 'X')) || - (position()>1 && index(0)=='0' && (index(1)=='x'||index(1)=='X') - && (ascii>='A'&& ascii<='F' || ascii>='a'&& ascii<='f')) || - input_type()==FL_FLOAT_INPUT && ascii && strchr(legal_fp_chars, ascii)) { + if (!ip && (ascii == '+' || ascii == '-') + || (ascii >= '0' && ascii <= '9') + || (ip==1 && index(0)=='0' && (ascii=='x' || ascii == 'X')) + || (ip>1 && index(0)=='0' && (index(1)=='x'||index(1)=='X') + && (ascii>='A'&& ascii<='F' || ascii>='a'&& ascii<='f')) + || input_type()==FL_FLOAT_INPUT && ascii && strchr(legal_fp_chars, ascii)) + { if (readonly()) fl_beep(); else replace(position(), mark(), &ascii, 1); }