Discussion:
[PATCH] Run DEPM when a selection is cleared
Vincent van Ravesteijn
2014-04-30 13:40:35 UTC
Permalink
The attached patch runs the DEPM when a selection is cleared. If this is
not done, there may be empty paragraphs and double whitespaces left behind.

Comments ?

Vincent
Jean-Marc Lasgouttes
2014-04-30 13:55:41 UTC
Permalink
Post by Vincent van Ravesteijn
The attached patch runs the DEPM when a selection is cleared. If this is
not done, there may be empty paragraphs and double whitespaces left behind.
How do we know that we are not suppressing spaces or paragraphs without
the calling code noticing it? I see potential for crashes.

JMarc
Vincent van Ravesteijn
2014-04-30 15:22:23 UTC
Permalink
Jean-Marc Lasgouttes schreef op 30-4-2014 15:55:

30/04/2014 15:40, Vincent van Ravesteijn:

The attached patch runs the DEPM when a selection is cleared. If this is
not done, there may be empty paragraphs and double whitespaces left behind.


How do we know that we are not suppressing spaces or paragraphs without the
calling code noticing it? I see potential for crashes.

JMarc


The general procedure for handling LFUNs that move the cursor is to:
- move the cursor with Text::setCursor (this calls the DEPM)
- set or unset the selection status with Cursor::selHandle (this now also
calls the DEPM).

So, in general the calling code is robust to suppressing space or
paragraphs as they almost always also move the cursor (which triggers the
depm as well).

I'm asking to see if someone knows what I'm overlooking.

Vincent
Jean-Marc Lasgouttes
2014-04-30 15:26:05 UTC
Permalink
Post by Vincent van Ravesteijn
- move the cursor with Text::setCursor (this calls the DEPM)
- set or unset the selection status with Cursor::selHandle (this now
also calls the DEPM).
So, in general the calling code is robust to suppressing space or
paragraphs as they almost always also move the cursor (which triggers
the depm as well).
OK.
Post by Vincent van Ravesteijn
I'm asking to see if someone knows what I'm overlooking.
Why do we do that when clearing the selection and not when beginning it?
Isn't this last solution less surprising to the user?

JMarc
Vincent van Ravesteijn
2014-04-30 16:39:41 UTC
Permalink
Post by Jean-Marc Lasgouttes
Post by Vincent van Ravesteijn
I'm asking to see if someone knows what I'm overlooking.
Why do we do that when clearing the selection and not when beginning
it? Isn't this last solution less surprising to the user?
Imagine the cursor is between two spaces, and the user selects to the
end of the line. Do we then remove the extra space inside or outside the
selection ? When the user then cuts the selection, he expects to have a
leading space when he pastes, and he expects to leave behind a space.
Also, when the user cuts the selection nothing had to be done in the
first place.

Vincent

Loading...