Howdy,

Andre Poenitz wrote:
> Dekel and Eran  (I suppose that are your given names, aren't they?)

Yup.


> Eran Tromer:

>  * When exiting the formula during selection, the anchor moves to the
>    left of the formula and there's no way to go back.
> 
> :: Once you are out of mathed you are out. The cursor is completely dead and
> :: will be recreated from scratch once you re-enter the inset. I could either
> :: save anchor state (which is not exactly nice) or

The overshooting-the-end problem (described in my longish post about
anchors) is quite annoying.
Proposal:
Define a small MathSelectionState class that contains anchor location
information. When existing mathed during selection, before deleting the
MathCursor, call "MathSelectionState MathCursor::getSelectionState()"
and store the result somewhere outside mathed. If the cursor re-enters
the same formula during the same selection, initialize the new
MathCursor using the remembered object.
For extra effect, make the object opaque (the Memento design pattern).
This requires some additions to code outside mathed, but I can't see how
that's avoidable without adding nasty state to formulas.


>  * \vec and friends have inset-ish behavior --
> 
> :: Probably due to being insets ;-}
> 
>    you need two <right> to
>    get past \vec{v}. Bad because the vecor signs don't look as if its
>    in the left-to-right "stream", and arguably not needed since you
>    can't edit the vector sign (unlike scripts) and making a new one is
>    very easy.

My text contains many \vec{v} thingies, now I need extra <left> and
<right> in all sort of situations. I think this is a very common case.
Also, $\vec{several-characters}$ doesn't produce the output you expect
--- the arrow has a fixed width.
\overrightarrow insets work in current cvs and handles the
multicharacter case very well, so think M-v v should be made to work as
before.


> ?? * When the cursor is in a subscript (and either isn't at the end of
> ??   the subscript or there's no subsubscript), pressing <down> should
> ??   try to *really* go down (to the next line, or denumerator, or
> ??   whatever). Currently it goes *up*. Ditto for superscripts.
> 
> :: Yes. It leaves one inset. Broken as designed. Changes this _logically_ is a
> :: mess. I could work around by introducing _physical_ movements, i.e. get the
> :: cursor position, increase it in small steps until SetPos() would go to
> :: another position. Take that position.  I don't like it....

Won't work: consider $\frac{xxxxxxxxxxxxxxxxxxxxxxxxxxxx_{|s}}{y}$.
Maybe there's a need for an explicit notion of vertical relation between
insets.

Here's a proposal. Rather complex, but logically clean.
------------------------------------------------
In the xcell array of math insets, assign an integer called 'floor' to
each cell, denoting relative vertical level: for instance, in \frac the
numerator is on floor 1 and the denominator on floor 0. This gives an
implicit tree structure on all the insets in the formula, with ordering
among the edges of each node (actually partially ordering, in case when
several subinsets are on the same floor). There remains only to traverse
this tree when needed:

Define the pseudofunctions (square brackets mark magic):

  // Return next lowest sibling inset, if any:
  MathInset inset_below(MathInset current, MathInset parent,
                        [horizontal cursor location]        )
  {  
     if [all subinsets of parent have floor >= current.floor]
        return null;
     else {
        floor_below = [ max{ x s.t. x < current->floor and
                             exists subinset S of 'parent' s.t.
                                    x = S->floor          } ];
        candidates = [ subinsets of 'parent' that have 
                       floor == floor_below ];
        return [ element of 'candidates' that's horizontally
                 closest to the cursor                       ];
     }
  }

   // Return topmost subinset:
   MathInset topmost_subinset(MathInset current, 
                              [horizontal cursor position] )
   {
      topmost_floor = [ max floor among all subinsets 
                          of current                        ];
      candidates = [ subinsets of of 'parent' that have
                     floor == topmost_floor ];
      return [ element of 'candidates' that's horizontally
               closest to the cursor                       ];
   }
    

Upon MathCursor action upon <down>:
{
   // Pop up insets until we can move down:
   while ( (below = inset_below(current, parent, [something]) == null )
{
      if (!pop()) [ do something smart ];
   }
   // Go to the topmost subsubsub...sub inset:
   while ( (topmost = topmost_subinset(current, [something]) ) {
      below = topmost;
   }
   [go to inset 'below']
}


Gotcha:
in $\frac{|xxx}{ \frac{y}{z} }$ we want <down> to do
   $\frac{xxx}{ \frac{|y}{z} }$ so the above logic works nicely.
However, in $\frac{xxx|}{ y^{s} }$ we want <down> to do
            $\frac{xxx}{ y^{s|} }$ rather than
            $\frac{xxx}{ y^{|s| }$ even though the superscript is
than the 'y'. This is true in general for scripts. So, give the 
script insets a floor value of +1000 (superscript) and -1000, and
tell topmost_subinset to ignore insets with these floor values.
------------------------------------------------


> ?? * Formula inside tabular cell: red frame of cell inset and purple
> ??   frame of formula can overlap, causing leftovers when leaving
> ??   formula. To get an example, insert a 1x1 tabular into a new document,
> ??   enter the cell its cell and press
> ??   M-m ( M-f 1 <right> <right> <right>
> 
> :: I cannot reproduce this

Try with zoom=100, screenDPI=100 in the Preferences | Look&Feel | Screen
Fonts.


All //ed bugs indeed seem OK. Updated buglist attached.

  Regards,
    Eran
// * Create a formula, insert a 2row by 1col array. Can select using 
//   mouse from top cell to outside the array. <del> then causes crash.

* When exiting the formula during selection, the anchor moves to the
  left of the formula and there's no way to go back.

* Scripts are too large. $\log_2$ exceeds inset frame (non-displayed).

* You need two <right> to get past \vec{v}, and all sort of other
  insetish behavior.

* \vec{several-characters} doesn't work. \overrightarrow does.

* When the cursor is in a subscript (and either isn't at the end of 
  the subscript or there's no subsubscript), pressing <down> should
  try to *really* go down (to the next line, or denumerator, or 
  whatever). Currently it goes *up*. Ditto for superscripts.

* When choosing to insert "\left\Vert \right\Vert" parenthesis using
  the maths [sic] panel, a "\left( \right." is inserted instead.

// * Pressing <backspace> in $\left( |foo \right)$  causes
//   $\left( foo \right) |foo$" instead of $|foo$.
// 
// * <del> in $\left( foo| \right)$ does nothing, should do $foo|$.

* Formula inside tabular cell: red frame of cell inset and purple 
  frame of formula can overlap, causing leftovers when leaving 
  formula. To get an example, insert a 1x1 tabular into a new document,
  enter the cell its cell and press 
  M-m ( M-f 1 <right> <right> <right>       (zoom=100, screenDPI=100)

* When selecting multiple cells in a array using the keyboard, <left>
  etc. should can move whole cell at a time -- no need to navigate 
  within cells.

* When selecting, maybe give a visual indication of the "original" 
  anchor, when it differs from the "actual" one.

* C-v always pastes into the end of the current math inset, instead of
  the cursor location.

// * <backspace> in $2^{x|}$ makes $x|$ (i.e., kills script inset). Very 
//   annoying when changing scripts. Perhaps require a second <backspace>
//   to delete the inset, as done for parenthesis? 

* Placement of cursor using mouse is seriously broken.
  Example 1: large fractions.
  Example 2: type into a new document: 
  "M-d xxxxxxxxx <right> M-x footnote-insert"
  Can't reach most places in the formula using mouse.

Reply via email to