[squeak-dev] How to reserve a small spacing for displaying the text cursor ?

tim Rowledge tim at rowledge.org
Wed Oct 2 22:41:54 UTC 2013


On 02-10-2013, at 3:16 PM, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
> Unfortunately, this space is not available for displaying the cursor, because it does not belong to the TextMorph…

Ouch. It *might* be worth remembering that a morph *can* display outside its bounds. At least, I'm pretty sure it can. That might work visually for some cases, though it would look pretty odd in a lot.

> 
> The cursor is always displayed to the right of CharacterBlock.
> So when at the left of the line it is inside TextMorph bounds and visible because away from the borders thanks to above 3 pixels guard.
> At the right of the line, it is generally visible, unless your last character unluckily fits exactly to the right bound.
> But if you rightFlush/justify, the characters are then perfectly aligned, and the cursor to the right of a line becomes invisible.

I think this is why gutters were invented in typography. An editable view simply needs enough room at the edges to allow the editing to work. If the cursor is at extreme left or right of the view, there has to be space for it. We shouldn't forget that LTR languages need the spaces swapped and perhaps the smart thing would just be the same size gutter each side to simplify that out of the problem. I guess the gutter width would need to be 'about as wide as the cursor in use' since cursors can be changed and it isn't terrible to cut off a bit if they're wide. Personally I like a simple 1-pixel wide vertical bar but I have seen people use more ornate graphics.


tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Hard work pays off in the future. Laziness pays off now.




More information about the Squeak-dev mailing list