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
This commit is contained in:
Matthias Melcher 2009-11-17 19:39:01 +00:00
parent 3c482f4efa
commit 337fcd2d2c
2 changed files with 10 additions and 6 deletions

View File

@ -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)

View File

@ -119,13 +119,16 @@ int Fl_Input::handle_key() {
}
#endif // HAVE_LOCALECONV
// find the insert position
int ip = position()<mark() ? position() : mark();
// This is complex to allow "0xff12" hex to be typed:
if (!position() && (ascii == '+' || ascii == '-') ||
(ascii >= '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);
}