It seems to me that lots of the const/mutable confusion in lyxtext comes
from the fact that cursor movement methods are declared const but are not
const at all, mostly because of the double space/double paragraph removal
mechanism.

As a first step, I propose the removal of constness to all methods that are
_not_ const, like cursorRight etc. They are not const below any point of
view (they cause rebreaks, redraws, cursor movement, etc, so no 'stability'
hipotesis can be made about them), and it's very confusing that they are
declared const. I can make a patch for this if wanted.

Thinking more about it, I think that the constantness of cursor movement is
hardwired in my brain, and I find counterintuitive and even frustrating the
present behaviour (Yes, I'm exagerating a little to obtain the desired
effect ;). This leads my to my second proposal:

What about removing the double space/par removal mechanism? Before you throw
me something in the head, I have some proposals to replace it:

Proposal 1) Plain forbid 3 spaces / 2 empty paragraphs (in order to
discourage space/newline formatting abuse, do not load nor save double
spaces, empty paragraphs).

Proposal 2) Mark double/triple/... spaces and empty pars with some
disgusting mark or colour, to encourage their removal. Can be combined with
1)

Proposal 3) A space after a space is forbidden, a space before makes the
cursor move to the right. Same for paragraphs: an enter after a newline
forbidden, an enter before a newline goes down.

Proposal 4) The same as 3) plus the following: with some kind of visual
feedback (a somewhat different cursor maybe) the about-to-be-added space is
remembered but not added yet. If the user types something, then it's added
and the space is added after it. 

I think that 4) is my prefered option, because it keeps the same concrete
behaviour than now. (but not the same visual)

Ok, now you can throw me something in the head.

Alfredo.

PS: I think that the removal of the double space/empty par mechanism can
lead to a _huge_ simplification in lyxtext code.

PS2: another thing that I don't like is the fact that a bv is passed to
almost all methods in lyxtext. As a lyxtext has one and only one bv, this
is absurd. (apart from the fact that I think that the use of bv from
lyxtext should be eliminated or kept to a minimum if possible)


Reply via email to