Re: justification/cursor navigation issues



On Fri, 2005-08-26 at 11:24 +0100, Damon Chaplin wrote:
> On Thu, 2005-08-25 at 16:35 -0400, Owen Taylor wrote:

> > While whitespace shouldn't be taken into account for line wrapping,
> > I don't know if trimming it is right.
> > 
> > Think about the behavior when editing left justified wrapped text -
> > when entering spaces at the end of the line, the cursor should continue
> > to move to the right ... (probably stopping at the right margin rather
> > than continuing and adding a scrollbar.)
> > 
> > It would be very odd if space did nothing until you typed the next
> > character.
> > 
> > So we need to know how wide the whitespace of a line is when computing
> > the cursor position. If we set it to zero with in the PangoGlyphString
> > then we've lost the necessary information.
> 
> I hadn't thought of the ragged text case before. That will need a few
> changes. (Argh!) I agree that we should fit in as many spaces as
> possible in that case.
> 
> For justified text I think you have to trim whitespace, except on the
> last line, where I suppose you do the same as for ragged text above.

Having thought more about this, and tried a few things out, I've changed
my mind a bit.

For ragged left text, you have to trim whitespace at the end of the
lines or the right margin will be messed up by whitespace.

For centered text you have to trim whitespace or it won't be centered
correctly (unless you subtract any whitespace at the ends of the line
when centering, but then you may accidentally overflow the width).

(I think the current Pango code gets both of the above wrong, btw.)


So now I think we should trim whitespace at the ends of lines, except
for the last line in the paragraph. This works OK most of the time,
though is a little confusing if you have to edit text at the end of a
line.

Another possible solution would be for the layout to be told where the
cursor is, and it could try to include any whitespace on that line
only. 

Or we could have a special case for ragged right and LTR text (and
ragged left/RTL), but trim in all other cases.

Damon





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]