On Sun, Apr 10, 2005 at 12:02:35AM +0200, Andre Poenitz wrote:
> On Sat, Apr 09, 2005 at 05:33:18PM +0300, Martin Vermeer wrote:
> > Here is the next patch... adding a cur.undispatched() statement did
> > the job.  So the LFUN_FINISHED mechanism seems to work... in this
> > case, it allowed he cursor to skip out of the inset, immediately to
> > the right of the parentesis, when pressing the END key. But how now do
> > I get it to go forward to the next parentesis, i.e., execute LFUN_END
> > for the parent inset? (Yes, I know, pressing the END key again. Not
> > what I wanted to hear :)
> 
> Maybe we should really have a 'request queue' in the cursor. This would
> certainly simplify the logic in this area:
> 
> When dispatching an LFUN_END at pos == lastpos, idx == lastidx, we'd
> simply pop off a cursor slice and re-add an LFUN_END request to that
> queue. 
> 
> LCursor::Dispatch would loop as long as there are events in that quue
> and ths pick up this re-added event in the next iteration and
> effectively dispatch it to the original inset's parent. No LFUN_FINISHED
> needed, no magical cursor.undispatch calls and even more flexible for
> the future as an inset may add more than one new event to the queue
> if needed etc...
> 
> Andre'

This sounds great... to make it perfectly clear, you propose to replace
the loop at

    204         for (; depth(); pop()) {
                  ...
    214                 disp_.update(true);
    215                 disp_.dispatched(true);
    216                 inset().dispatch(*this, cmd);
    217                 if (disp_.dispatched())
    218                         break;
    219         }

by a similar one testing for

                while(!lfun_queue.empty()) {
                   ...
                inset().dispatch(*this, cmd);
                lfun_queue.pop_back();
                }

ands replace the stanzas (pseudo-code, didn't check C++ syntax)

        case LFUN_<something>:
                <do something>;
                cmd = FuncRequest(LFUN_FINISHED_<direction>);
                cur.undispatched();
                break;
by
        case LFUN_<something>:
                <do something>;
                cur.lfun_queue.push_back(LFUN_<something>));
                break;
?

The current solution is indeed a bit of a kludge, as it allows only
queing of a single LFUN to the inset level above.

Perhaps not for 1.4.0 though as we're in freeze.

- Martin

Attachment: pgp1LKb3VZ4mG.pgp
Description: PGP signature

Reply via email to