this fixes two crashes (I think - JMarc does it look right to you ?)
thanks john -- "This bulletin discusses three security vulnerabilities that are unrelated except in the sense that both affect ISA Server 2000" - Microsoft Product Security
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.384 diff -u -r1.384 ChangeLog --- src/ChangeLog 2001/11/05 17:07:22 1.384 +++ src/ChangeLog 2001/11/07 17:17:17 @@ -1,3 +1,8 @@ +2001-11-07 John Levon <[EMAIL PROTECTED]> + + * minibuffer.h: + * minibuffer.C: fix crash, improve drop-down completion + 2001-11-03 John Levon <[EMAIL PROTECTED]> * minibuffer.h: Index: src/minibuffer.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/minibuffer.C,v retrieving revision 1.42 diff -u -r1.42 minibuffer.C --- src/minibuffer.C 2001/11/05 17:07:22 1.42 +++ src/minibuffer.C 2001/11/07 17:17:23 @@ -70,7 +70,7 @@ void MiniBuffer::dd_init() { dropdown_ = new DropDown(owner_, the_buffer); - dropdown_->result.connect(slot(this, &MiniBuffer::set_input)); + dropdown_->result.connect(slot(this, &MiniBuffer::set_complete_input)); } @@ -153,14 +153,15 @@ // Perfect match string const tmp = comp[0] + _(" [sole completion]"); - stored_set(comp[0]); + stored_set(comp[0] + " "); set_input(tmp); } else { // More that one match // Find maximal avaliable prefix string const tmp = comp[0]; string test(input); - test += tmp[test.length()]; + if (tmp.length() > test.length()) + test += tmp[test.length()]; while (test.length() < tmp.length()) { vector<string> vtmp; lyx::copy_if(comp.begin(), @@ -378,6 +379,13 @@ } +void MiniBuffer::set_complete_input(string const & str) +{ + if (!str.empty()) + set_input(str); +} + + void MiniBuffer::set_input(string const & str) { fl_set_input(the_buffer, str.c_str()); Index: src/minibuffer.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/minibuffer.h,v retrieving revision 1.20 diff -u -r1.20 minibuffer.h --- src/minibuffer.h 2001/11/05 17:07:22 1.20 +++ src/minibuffer.h 2001/11/07 17:17:23 @@ -74,7 +74,9 @@ void stored_slot(); /// void stored_set(string const &); - /// + /// set the minibuffer content if str non-empty + void set_complete_input(string const &); + /// set the minibuffer content void set_input(string const &); /// void init(); Index: src/frontends/xforms/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v retrieving revision 1.193 diff -u -r1.193 ChangeLog --- src/frontends/xforms/ChangeLog 2001/11/05 17:07:23 1.193 +++ src/frontends/xforms/ChangeLog 2001/11/07 17:17:34 @@ -1,3 +1,7 @@ +2001-11-07 John Levon <[EMAIL PROTECTED]> + + * DropDown.C: fix crash, improve behaviour a bit + 2001-11-03 John Levon <[EMAIL PROTECTED]> * Makefile.am: Index: src/frontends/xforms/DropDown.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/DropDown.C,v retrieving revision 1.1 diff -u -r1.1 DropDown.C --- src/frontends/xforms/DropDown.C 2001/11/05 17:07:23 1.1 +++ src/frontends/xforms/DropDown.C 2001/11/07 17:17:34 @@ -100,6 +100,7 @@ fl_hide_form(form_); return 1; } + XUngrabPointer(fl_get_display(), CurrentTime); } else if (xev->type == KeyPress) { char s_r[10]; s_r[9] = '\0'; KeySym keysym_return; @@ -114,6 +115,18 @@ case XK_Return: completed(); return 1; + case XK_Escape: + fl_select_browser_line(browser_, 0); + completed(); + return 1; + default: + // FIXME: if someone has a got a way to + // convince the event to fall back to the + // minibuffer, I'm glad to hear it. + // fl_XPutBackEvent() doesn't work. + fl_select_browser_line(browser_, 0); + completed(); + return 1; } } return 0; @@ -122,9 +135,10 @@ void DropDown::completed() { + XUngrabPointer(fl_get_display(), CurrentTime); string selection; int i = fl_get_browser(browser_); - if (i == -1) + if (i < 1) selection = ""; else selection = fl_get_browser_line(browser_, i);