Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-nice.1313.mcz ==================== Summary ==================== Name: Morphic-nice.1313 Author: nice Time: 27 October 2016, 2:34:24.410239 am UUID: b6649d12-cd6a-4957-94c0-ddc37d0f253a Ancestors: Morphic-tpr.1312 Correct the text selection when extending down over a long word that was rejected on next line. The scenario is when a long word following a space does not fit on the end of line: it is displayed on next line. If user click right after the space and extend the selection by dragging down on next line, then the selection from left of next line to right of space is not displayed. This is because the start CharacterBlock has its topLeft = space topRight (+ eventual kern). Fortunately, a simple <= test instead of < solves the problem. =============== Diff against Morphic-tpr.1312 =============== Item was changed: ----- Method: NewParagraph>>displaySelectionInLine:on: (in category 'display') ----- displaySelectionInLine: line on: aCanvas | leftX rightX w | selectionStart ifNil: [^self]. "No selection" aCanvas isShadowDrawing ifTrue: [ ^self ]. "don't draw selection with shadow" selectionStart = selectionStop ifTrue: ["Only show caret on line where clicked" selectionStart textLine ~= line ifTrue: [^self]] ifFalse: ["Test entire selection before or after here" (selectionStop stringIndex < line first or: [selectionStart stringIndex > (line last + 1)]) ifTrue: [^self]. "No selection on this line" (selectionStop stringIndex = line first and: [selectionStop textLine ~= line]) ifTrue: [^self]. "Selection ends on line above" (selectionStart stringIndex = (line last + 1) and: [selectionStop textLine ~= line]) ifTrue: [^self]]. "Selection begins on line below" + leftX := (selectionStart stringIndex <= line first - leftX := (selectionStart stringIndex < line first ifTrue: [line ] ifFalse: [selectionStart ])left. rightX := (selectionStop stringIndex > (line last + 1) or: [selectionStop stringIndex = (line last + 1) and: [selectionStop textLine ~= line]]) ifTrue: [line right] ifFalse: [selectionStop left]. selectionStart = selectionStop ifTrue: [ rightX := rightX + 1. caretRect := (leftX-2) @ line top corner: (rightX+2)@ line bottom. "sigh..." self showCaret ifFalse: [^self]. w := (Editor dumbbellCursor ifTrue: [self displayDumbbellCursorOn: aCanvas at: leftX in: line] ifFalse: [self displaySimpleCursorOn: aCanvas at: leftX in: line]). caretRect := (leftX-w) @ line top corner: (rightX+w)@ line bottom] ifFalse: [ caretRect := nil. aCanvas fillRectangle: (leftX @ line top corner: rightX @ line bottom) color: (self focused ifTrue: [self selectionColor] ifFalse: [self unfocusedSelectionColor])]! |
Not sure if it's OK for anything else than leftFlush, but this one was upsetting me for a while (inspector panes are often narrow in debuggers)2016-10-27 2:35 GMT+02:00 <[hidden email]>: Nicolas Cellier uploaded a new version of Morphic to project The Trunk: |
In reply to this post by commits-2
Yaay, we've got mail!
Thank you, Tobias. On Wed, Oct 26, 2016 at 7:35 PM, <[hidden email]> wrote: > Nicolas Cellier uploaded a new version of Morphic to project The Trunk: > http://source.squeak.org/trunk/Morphic-nice.1313.mcz > > ==================== Summary ==================== > > Name: Morphic-nice.1313 > Author: nice > Time: 27 October 2016, 2:34:24.410239 am > UUID: b6649d12-cd6a-4957-94c0-ddc37d0f253a > Ancestors: Morphic-tpr.1312 > > Correct the text selection when extending down over a long word that was rejected on next line. > > The scenario is when a long word following a space does not fit on the end of line: it is displayed on next line. > If user click right after the space and extend the selection by dragging down on next line, then the selection from left of next line to right of space is not displayed. > > This is because the start CharacterBlock has its topLeft = space topRight (+ eventual kern). > Fortunately, a simple <= test instead of < solves the problem. > > =============== Diff against Morphic-tpr.1312 =============== > > Item was changed: > ----- Method: NewParagraph>>displaySelectionInLine:on: (in category 'display') ----- > displaySelectionInLine: line on: aCanvas > | leftX rightX w | > selectionStart ifNil: [^self]. "No selection" > aCanvas isShadowDrawing ifTrue: [ ^self ]. "don't draw selection with shadow" > selectionStart = selectionStop > ifTrue: > ["Only show caret on line where clicked" > > selectionStart textLine ~= line ifTrue: [^self]] > ifFalse: > ["Test entire selection before or after here" > > (selectionStop stringIndex < line first > or: [selectionStart stringIndex > (line last + 1)]) ifTrue: [^self]. "No selection on this line" > (selectionStop stringIndex = line first > and: [selectionStop textLine ~= line]) ifTrue: [^self]. "Selection ends on line above" > (selectionStart stringIndex = (line last + 1) > and: [selectionStop textLine ~= line]) ifTrue: [^self]]. "Selection begins on line below" > + leftX := (selectionStart stringIndex <= line first > - leftX := (selectionStart stringIndex < line first > ifTrue: [line ] > ifFalse: [selectionStart ])left. > rightX := (selectionStop stringIndex > (line last + 1) or: > [selectionStop stringIndex = (line last + 1) > and: [selectionStop textLine ~= line]]) > ifTrue: [line right] > ifFalse: [selectionStop left]. > selectionStart = selectionStop > ifTrue: [ > rightX := rightX + 1. > caretRect := (leftX-2) @ line top corner: (rightX+2)@ line bottom. "sigh..." > self showCaret ifFalse: [^self]. > w := (Editor dumbbellCursor > ifTrue: [self displayDumbbellCursorOn: aCanvas at: leftX in: line] > ifFalse: [self displaySimpleCursorOn: aCanvas at: leftX in: line]). > caretRect := (leftX-w) @ line top corner: (rightX+w)@ line bottom] > ifFalse: [ > caretRect := nil. > aCanvas fillRectangle: (leftX @ line top corner: rightX @ line bottom) > color: (self focused ifTrue: [self selectionColor] ifFalse: [self unfocusedSelectionColor])]! > > |
Free forum by Nabble | Edit this page |