mirror of
https://github.com/fltk/fltk.git
synced 2026-06-02 23:56:55 +08:00
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.3@6941 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+15
-12
@@ -119,13 +119,16 @@ int Fl_Input::handle_key() {
|
|||||||
}
|
}
|
||||||
#endif // HAVE_LOCALECONV
|
#endif // HAVE_LOCALECONV
|
||||||
|
|
||||||
|
// find the insert position
|
||||||
|
int ip = position()<mark() ? position() : mark();
|
||||||
// This is complex to allow "0xff12" hex to be typed:
|
// This is complex to allow "0xff12" hex to be typed:
|
||||||
if (!position() && (ascii == '+' || ascii == '-') ||
|
if (!ip && (ascii == '+' || ascii == '-')
|
||||||
(ascii >= '0' && ascii <= '9') ||
|
|| (ascii >= '0' && ascii <= '9')
|
||||||
(position()==1 && index(0)=='0' && (ascii=='x' || ascii == 'X')) ||
|
|| (ip==1 && index(0)=='0' && (ascii=='x' || ascii == 'X'))
|
||||||
(position()>1 && index(0)=='0' && (index(1)=='x'||index(1)=='X')
|
|| (ip>1 && index(0)=='0' && (index(1)=='x'||index(1)=='X')
|
||||||
&& (ascii>='A'&& ascii<='F' || ascii>='a'&& ascii<='f')) ||
|
&& (ascii>='A'&& ascii<='F' || ascii>='a'&& ascii<='f'))
|
||||||
input_type()==FL_FLOAT_INPUT && ascii && strchr(legal_fp_chars, ascii)) {
|
|| input_type()==FL_FLOAT_INPUT && ascii && strchr(legal_fp_chars, ascii))
|
||||||
|
{
|
||||||
if (readonly()) fl_beep();
|
if (readonly()) fl_beep();
|
||||||
else replace(position(), mark(), &ascii, 1);
|
else replace(position(), mark(), &ascii, 1);
|
||||||
}
|
}
|
||||||
@@ -362,13 +365,13 @@ int Fl_Input::handle_key() {
|
|||||||
case 'v' :
|
case 'v' :
|
||||||
case 'x' :
|
case 'x' :
|
||||||
case 'z' :
|
case 'z' :
|
||||||
// printf("'%c' (0x%02x) pressed with%s%s%s%s\n", ascii, ascii,
|
// printf("'%c' (0x%02x) pressed with%s%s%s%s\n", ascii, ascii,
|
||||||
// Fl::event_state(FL_SHIFT) ? " FL_SHIFT" : "",
|
// Fl::event_state(FL_SHIFT) ? " FL_SHIFT" : "",
|
||||||
// Fl::event_state(FL_CTRL) ? " FL_CTRL" : "",
|
// Fl::event_state(FL_CTRL) ? " FL_CTRL" : "",
|
||||||
// Fl::event_state(FL_ALT) ? " FL_ALT" : "",
|
// Fl::event_state(FL_ALT) ? " FL_ALT" : "",
|
||||||
// Fl::event_state(FL_META) ? " FL_META" : "");
|
// Fl::event_state(FL_META) ? " FL_META" : "");
|
||||||
if (Fl::event_state(FL_META)) ascii -= 0x60;
|
if (Fl::event_state(FL_META)) ascii -= 0x60;
|
||||||
// printf("using '%c' (0x%02x)...\n", ascii, ascii);
|
// printf("using '%c' (0x%02x)...\n", ascii, ascii);
|
||||||
break;
|
break;
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,7 @@ static void cb_tree(Fl_Tree*, void*) {
|
|||||||
Fl_Tree_Item *item = tree->item_clicked();
|
Fl_Tree_Item *item = tree->item_clicked();
|
||||||
//item->select( item->is_selected() ? 0 : 1);
|
//item->select( item->is_selected() ? 0 : 1);
|
||||||
//tree->redraw();
|
//tree->redraw();
|
||||||
fprintf(stderr, "TREE CALLBACK: label='%s' userdata=%d\n",
|
fprintf(stderr, "TREE CALLBACK: label='%s' userdata=%ld\n",
|
||||||
item->label(),
|
item->label(),
|
||||||
(long)tree->user_data());
|
(long)tree->user_data());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user