+extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT * ob, long data)
+{
+ MiniBuffer::TimerCB(ob, data);
+}
+
+// This is not as dirty as it seems, the hidden buttons removed by this
+// function were just kludges for an uncomplete keyboard callback (ale)
+int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
+ int key, void */*xev*/)
+{
+ MiniBuffer * mini = static_cast<MiniBuffer*>(ob->u_vdata);
+
+ if (event == FL_KEYBOARD){
+ switch (key) {
+ case XK_Down:
+ mini->history_idx++;
+ if (!mini->getHistory().empty()) {
+ fl_set_input(ob, mini->getHistory().c_str());
+ } else
+ mini->history_idx--;
+ return 1;
+ case XK_Up:
+ if (mini->history_idx > 0) mini->history_idx--;
+ fl_set_input(ob, mini->getHistory().c_str());
+ return 1;
+ case 9:
+ case XK_Tab:
+ {
+ // complete or increment the command
+ string s = lyxaction.getApproxFuncName(fl_get_input(ob));
+ if (!s.empty())
+ fl_set_input(ob, s.c_str());
+ return 1;
+ }
+ case 27:
+ case XK_Escape:
+ // Abort
+ mini->owner->view()->focus(true);
+ mini->Init();
+ return 1;
+ case 13:
+ case XK_Return:
+ // Execute a command.
+ mini->cur_cmd = string(fl_get_input(ob));
+ ExecutingCB(ob, 0);
+ return 1;
+ default:
+ return 0;
+ }
+ }
+ return 0;
+}
+
+extern "C" int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event,
+ FL_Coord, FL_Coord,
+ int key, void * xev)
+{
+ return MiniBuffer::peek_event(ob, event, 0, 0, key, xev);
+}
+