Re: word-backward/forward in mathed

2003-12-09 Thread Christian Ridderström
On Tue, 9 Dec 2003, Andre Poenitz wrote:

> > With the risk of being troublemaker, maybe \textrm{} should induce an 
> > editing mode that's more like in TextEd? I really like what we have so 
> > far, i.e. you press C-m and get a text-like inset, where Space works etc.
> > 
> > But icing on the cake would be to have C-Left/Right go to word boundaris 
> > inside this 'text-inset', and similarly, S-C-Left/Right should select up 
> > to word boundaries.
> > 
> > Anyway, just a thought.
> 
> Feel free to implement it.
> 
> Btw, i the long run I expect mathed and non-math insets properly
> nestable, so we'd have an InsetText in mathed with all its
> functionality...

That' much better, and since I assume the TextInset would automatically 
inherit the "right" behaviour of the keyboard shortcuts. Implementing the 
above would therefore be a waste of time in the long run.

/Christian

-- 
Dr. Christian Ridderström, +46-8-768 39 44   http://www.md.kth.se/~chr



Re: word-backward/forward in mathed

2003-12-09 Thread Andre Poenitz
On Tue, Dec 09, 2003 at 02:53:49PM +0100, Christian Ridderström wrote:
> On Mon, 8 Dec 2003, Andre Poenitz wrote:
> >  
> > > In fact, even inside \textrm{adsfas asdf asfd} word-backward/forward
> > > doesn't work (i.e. go to the next word separated by a space).
> > 
> > Mathed has almost no idea what a 'word' or a 'space' is.
> 
> With the risk of being troublemaker, maybe \textrm{} should induce an 
> editing mode that's more like in TextEd? I really like what we have so 
> far, i.e. you press C-m and get a text-like inset, where Space works etc.
> 
> But icing on the cake would be to have C-Left/Right go to word boundaris 
> inside this 'text-inset', and similarly, S-C-Left/Right should select up 
> to word boundaries.
> 
> Anyway, just a thought.

Feel free to implement it.

Btw, i the long run I expect mathed and non-math insets properly
nestable, so we'd have an InsetText in mathed with all its
functionality...

Andre'


Re: word-backward/forward in mathed

2003-12-09 Thread Andre Poenitz
On Tue, Dec 09, 2003 at 02:28:42PM +0100, Christian Ridderström wrote:
> I will use a '|' to indicate the cursor position, so:
> 
>   a|+ ( b + c ) + d
> 
> means that the cursor is just after the first 'a'. I'll use the following 
> notation to indicate the cursor position before a movement, the 
> shortcut that is used and the desired position aftewards:
> 
>   a|+ ( b + c ) + d   [Right] a +|( b + c ) + d
> 
> Now, pressing C-Right, I'd like this to happen:
> 
> a +|( b + c ) + d   [C-Right]   a + ( b + c )|+ d
> 
> where the sub-inset '( b + c)' was skipped over. If there is no sub-inset, 
> it should go to the end like here:
> 
> a + ( b + c )|+ d   [C-Right]   a + ( b + c ) + d|
> 
> Going in the other direction, C-Left should move until it has skipped one 
> sub-inset or reached the beginning, i.e. like this:
> 
> a + ( b + c ) + d|  [C-Left]a +|( b + c ) + d
> 
> I hope you can understand what I mean with these examples.

I think so. But this requires quite a lot of special code as far as I
can tell with no really predictable results...

Well, as I won't use that feature I should not care too much. So if you
code it up and the result is not overly ugly and you get support for
that feature of one or two other users I would apply that patch.

Andre'


Re: word-backward/forward in mathed

2003-12-09 Thread Christian Ridderström
On Mon, 8 Dec 2003, Andre Poenitz wrote:
>  
> > In fact, even inside \textrm{adsfas asdf asfd} word-backward/forward
> > doesn't work (i.e. go to the next word separated by a space).
> 
> Mathed has almost no idea what a 'word' or a 'space' is.

With the risk of being troublemaker, maybe \textrm{} should induce an 
editing mode that's more like in TextEd? I really like what we have so 
far, i.e. you press C-m and get a text-like inset, where Space works etc.

But icing on the cake would be to have C-Left/Right go to word boundaris 
inside this 'text-inset', and similarly, S-C-Left/Right should select up 
to word boundaries.

Anyway, just a thought.

/Christian

-- 
Christian Ridderström   http://www.md.kth.se/~chr




Re: word-backward/forward in mathed

2003-12-09 Thread Christian Ridderström
On Mon, 8 Dec 2003, Andre Poenitz wrote:

> > While on the subject, something's rotten in Denmark.. mathed, since
> > 
> > line-beginning/end
> > 
> > behave the same as
> > 
> > word-backward/forward
> > 
> > as far as I can tell.
> 
> Such things could be proven quickly by looking at the source.

Aha! A challenge, well, AFAIC tell they do the same thing, i.e.
case LFUN_END:
case LFUN_WORDRIGHT:
result = mathcursor->end(sel) ? DispatchResult(true, true) : 
DispatchResult(false, FINISHED_RIGHT);
break;

and

case LFUN_HOME:
case LFUN_WORDLEFT:
result = mathcursor->home(sel) ? DispatchResult(true, true) : 
DispatchResult(true, FINISHED);
break;

> > Both move the cursor to the first or last position 
> > of the mathed box, and this seems pointless to me.
> 
> Better idea?

Some... in the text below, I'll refer to keyboard shortcuts instead of 
LFUNs because it's shorter (for Andre: C-Left = word-backward etc).
Another reason is that this is what the user sees --- I'm looking at 
this from the view of a user, and not from how it is implemented.

Now, since HOME === C-Left, and END === C-Right in MathEd, we have room to 
change the behaviour of either pair without the user loosing functionality.

I started thinking about what kind of movements I would like to get 
for these shortcuts, and unfortunately it's not that obvious... it gets 
really complicated when you realize that math-insets corresponds to much 
more than simple mathematical expressions. One way to go forward here 
would be to start looking at what kind of expressions and movment 
operations are most common etc, but that'll take time...

So, if we want a quick "fix" (it's not like anything *really* is broken,
the mathed-interface works quite nice in general), I'd like to suggest 
that we try the following:

The behaviour of HOME/END seems ok, so let's keep that and find a new 
behaviour for C-Left/Right. My original complaint was that Left/Right 
produces small movements, and C-Left/Right too large movements, so I want 
something in between.

For C-Left/Right, I would like to try something that "skips sub-insets", 
just like S-Left/Right does if the cursor is next to a sub-inset (without 
selecting anything of course). I'll try to illustrate what I'd like using 
an example based on this equation:

a + ( b + c ) + d

where (b+c) is what I call a sub-inset. The equation was created by typing

"a+", M-m (, "b+c", Right, "+d" 

I will use a '|' to indicate the cursor position, so:

a|+ ( b + c ) + d

means that the cursor is just after the first 'a'. I'll use the following 
notation to indicate the cursor position before a movement, the 
shortcut that is used and the desired position aftewards:

a|+ ( b + c ) + d   [Right] a +|( b + c ) + d

Now, pressing C-Right, I'd like this to happen:

a +|( b + c ) + d   [C-Right]   a + ( b + c )|+ d

where the sub-inset '( b + c)' was skipped over. If there is no sub-inset, 
it should go to the end like here:

a + ( b + c )|+ d   [C-Right]   a + ( b + c ) + d|

Going in the other direction, C-Left should move until it has skipped one 
sub-inset or reached the beginning, i.e. like this:

a + ( b + c ) + d|  [C-Left]a +|( b + c ) + d

I hope you can understand what I mean with these examples.

/Christian

-- 
Christian Ridderström   http://www.md.kth.se/~chr




Re: word-backward/forward in mathed

2003-12-09 Thread Jean-Marc Lasgouttes
> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes:

Andre> On Mon, Dec 08, 2003 at 10:12:16AM +0100, Jean-Marc Lasgouttes
Andre> wrote:
>> What word-backward/forward could to is jump over insets instead of
>> entering them. The equivalent of a 'word' in mathed is an inset (a
>> block) IMO.

Andre> It does so already.

What I meant is that it could work like char-backward/forward,
_except_ that it would not enter insets. This means that a 'word' is
an inset.

JMarc


Re: word-backward/forward in mathed

2003-12-08 Thread Andre Poenitz
On Mon, Dec 08, 2003 at 10:12:16AM +0100, Jean-Marc Lasgouttes wrote:
> What word-backward/forward could to is jump over insets instead of
> entering them. The equivalent of a 'word' in mathed is an inset (a
> block) IMO.

It does so already.

Andr'e


Re: word-backward/forward in mathed

2003-12-08 Thread Jean-Marc Lasgouttes
> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes:

>> Now back from the break, my suggestion is that we change the
>> behaviour of word-backward/forward so that it uses something other
>> spaces as word separators. One idea could be to use '+' and '-',
>> essentially moving the cursor one term at a time in a formula.

Andre> This is close to useless. I have one-page-formulas where '+'
Andre> and '-' appear (at best) in some index computations. So going
Andre> to the begin of the current box is much more sensible than
Andre> searching for the next '+'.

What word-backward/forward could to is jump over insets instead of
entering them. The equivalent of a 'word' in mathed is an inset (a
block) IMO.

JMarc


Re: word-backward/forward in mathed

2003-12-08 Thread Andre Poenitz
On Fri, Dec 05, 2003 at 07:29:18PM +0100, Christian Ridderström wrote:
> This started in some charStyle thread... it is about a suggestion to 
> change the behaviour of C-left/right in mathed (aka word-backward/forward)
> 
> Originally I was (approx.) complaining that it takes a lot of left/right's
> to move in mathed because of all the boundaries you have to cross.
> Then I suggested that maybe C-left/right could be used to move at a 
> 'courser' level...
> 
> [Brief interlude in the dialog were we are informed of Andre's 14 year 
>  old configuration of his window manager - it steals his C-left/right)

[It doesn't steal it. It does what it is supposed to do...]

> Now back from the break, my suggestion is that we change the behaviour of 
> word-backward/forward so that it uses something other spaces as word 
> separators. One idea could be to use '+' and '-', essentially moving the 
> cursor one term at a time in a formula.

This is close to useless. I have one-page-formulas where '+' and '-'
appear (at best) in some index computations. So going to the begin of
the current box is much more sensible than searching for the next '+'.

> While on the subject, something's rotten in Denmark.. mathed, since
> 
> line-beginning/end
> 
> behave the same as
> 
> word-backward/forward
> 
> as far as I can tell.

Such things could be proven quickly by looking at the source.

> Both move the cursor to the first or last position 
> of the mathed box, and this seems pointless to me.

Better idea?
 
> In fact, even inside \textrm{adsfas asdf asfd} word-backward/forward
> doesn't work (i.e. go to the next word separated by a space).

Mathed has almost no idea what a 'word' or a 'space' is.
 
> Anyway, my conclusion (?) is perhaps that a 'word' in a formula should
> correspond to something like a 'term' in a mathematical expression.

How do you detect a term?

Andre'


word-backward/forward in mathed

2003-12-05 Thread Christian Ridderström
This started in some charStyle thread... it is about a suggestion to 
change the behaviour of C-left/right in mathed (aka word-backward/forward)

Originally I was (approx.) complaining that it takes a lot of left/right's
to move in mathed because of all the boundaries you have to cross.
Then I suggested that maybe C-left/right could be used to move at a 
'courser' level...

[Brief interlude in the dialog were we are informed of Andre's 14 year 
 old configuration of his window manager - it steals his C-left/right)

Now back from the break, my suggestion is that we change the behaviour of 
word-backward/forward so that it uses something other spaces as word 
separators. One idea could be to use '+' and '-', essentially moving the 
cursor one term at a time in a formula.

While on the subject, something's rotten in Denmark.. mathed, since

line-beginning/end

behave the same as

word-backward/forward

as far as I can tell. Both move the cursor to the first or last position 
of the mathed box, and this seems pointless to me.

In fact, even inside \textrm{adsfas asdf asfd} word-backward/forward
doesn't work (i.e. go to the next word separated by a space).

Anyway, my conclusion (?) is perhaps that a 'word' in a formula should
correspond to something like a 'term' in a mathematical expression.

/Christian

-- 
Christian Ridderström   http://www.md.kth.se/~chr