You can no longer insert ^J,^K,^L,^M into Fl_Int/Float_Input.

Fixed bug noticed by Alexander Rabi Beels, if you are in point-to-type
and move the cursor to a different window with a multiline input and
type up/down, the saved up/down horizontal position from the previous
multiline input was used.  It now resets this on any focus change,
fixing this.

Some code cleanup in Fl_Input.cxx, removed unneeded calls to Fl::compose_reset.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1191 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak 2000-06-10 21:31:00 +00:00
parent b3d9c227bc
commit abcd0b4488
2 changed files with 11 additions and 16 deletions

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl.cxx,v 1.24.2.24 2000/06/05 21:20:46 mike Exp $" // "$Id: Fl.cxx,v 1.24.2.25 2000/06/10 21:30:59 bill Exp $"
// //
// Main event handling code for the Fast Light Tool Kit (FLTK). // Main event handling code for the Fast Light Tool Kit (FLTK).
// //
@ -321,6 +321,7 @@ void Fl::focus(Fl_Widget *o) {
if (grab()) return; // don't do anything while grab is on if (grab()) return; // don't do anything while grab is on
Fl_Widget *p = focus_; Fl_Widget *p = focus_;
if (o != p) { if (o != p) {
Fl::compose_reset();
focus_ = o; focus_ = o;
fl_oldfocus = 0; fl_oldfocus = 0;
for (; p && !p->contains(o); p = p->parent()) { for (; p && !p->contains(o); p = p->parent()) {
@ -720,5 +721,5 @@ void Fl_Window::flush() {
} }
// //
// End of "$Id: Fl.cxx,v 1.24.2.24 2000/06/05 21:20:46 mike Exp $". // End of "$Id: Fl.cxx,v 1.24.2.25 2000/06/10 21:30:59 bill Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Input.cxx,v 1.10.2.10 2000/06/05 21:20:52 mike Exp $" // "$Id: Fl_Input.cxx,v 1.10.2.11 2000/06/10 21:31:00 bill Exp $"
// //
// Input widget for the Fast Light Tool Kit (FLTK). // Input widget for the Fast Light Tool Kit (FLTK).
// //
@ -112,16 +112,12 @@ int Fl_Input::handle_key() {
else else
return 0; // reserved for shortcuts return 0; // reserved for shortcuts
case FL_Tab: case FL_Tab:
if (Fl::event_state(FL_CTRL) || type()!=FL_MULTILINE_INPUT) return 0; if (Fl::event_state(FL_CTRL|FL_SHIFT) || type()!=FL_MULTILINE_INPUT) return 0;
return replace(position(), mark(), &ascii, 1); return replace(position(), mark(), &ascii, 1);
default:
if (!ascii) return 0; // don't reset compose on shift keys
} }
Fl::compose_reset();
int i; int i;
switch(ascii) { switch (ascii) {
case ctrl('A'): case ctrl('A'):
if (type() == FL_MULTILINE_INPUT) if (type() == FL_MULTILINE_INPUT)
for (i=position(); i && index(i-1)!='\n'; i--) ; for (i=position(); i && index(i-1)!='\n'; i--) ;
@ -189,7 +185,7 @@ int Fl_Input::handle_key() {
case ctrl('L'): case ctrl('L'):
case ctrl('M'): case ctrl('M'):
// insert a few selected control characters literally: // insert a few selected control characters literally:
if (type() != FL_FLOAT_INPUT || type() != FL_INT_INPUT) if (type() != FL_FLOAT_INPUT && type() != FL_INT_INPUT)
return replace(position(), mark(), &ascii, 1); return replace(position(), mark(), &ascii, 1);
} }
@ -218,13 +214,12 @@ int Fl_Input::handle(int event) {
case 0xfe20: // XK_ISO_Left_Tab case 0xfe20: // XK_ISO_Left_Tab
position(size(),0); position(size(),0);
break; break;
default:
position(position(),mark());// turns off the saved up/down arrow position
break;
} }
break; break;
case FL_UNFOCUS:
Fl::compose_reset();
break;
case FL_KEYBOARD: case FL_KEYBOARD:
return handle_key(); return handle_key();
@ -240,7 +235,6 @@ int Fl_Input::handle(int event) {
} }
#endif #endif
} }
Fl::compose_reset();
break; break;
case FL_RELEASE: case FL_RELEASE:
@ -265,5 +259,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l)
} }
// //
// End of "$Id: Fl_Input.cxx,v 1.10.2.10 2000/06/05 21:20:52 mike Exp $". // End of "$Id: Fl_Input.cxx,v 1.10.2.11 2000/06/10 21:31:00 bill Exp $".
// //