On Mon, Apr 27, 2015 at 8:41 PM, Andrei Chis <chisvasileandrei@gmail.com> wrote:
Hi,
In the glamour debugger that we use in moose we are now having the following problem: - the selection of a PluggableTextMorph is, quite randomly , changed during styling.
If I revert the fix for issue 15240 <https://pharo.fogbugz.com/f/cases/15240> then it works ok. Also if I change in SHTextStyler>>#styleInBackgroundProcess: from
sem waitTimeoutSeconds: 5. view ifNotNil: [ view stylerStyledInBackground: text ]
to:
(sem waitTimeoutSeconds: 5) ifFalse: [ view ifNotNil: [ view stylerStyledInBackground: text ] ]
it works ok. In the second snippet we only do the styling if the styler completed.
If I look at the senders of styleInBackgroundProcess: there is another strange issue. First PluggableTextMorph>>#setText: calls either style: or styleInBackgroundProcess:, depending in the size of the text. Then, PluggableTextMorph>>#setText: calls PluggableTextMorph>>#setTextBasic:, which calls PluggableTextMorph>>#hasUnacceptedEdits: which in turn calls again styleInBackgroundProcess:. So when you set the text if the size of the text is small Shout will try to style the text with and without a background process. If you call hasUnacceptedEdits: manually when initializing the morph then three processes will be started for doing the styling.
Removing the calls to styleInBackgroundProcess: from PluggableTextMorph>>#hasUnacceptedEdits: and PluggableTextMorph>>#basicHasUnacceptedEdits:. also solves the problem with the changing selection.
Cheers, Andrei
Perhaps we should have... sem waitTimeoutSeconds: 5 ifSignalled: [ view ifNotNil: [ view stylerStyledInBackground: text ] ] ifTimedOut: [ "do nothing" ]. cheers -ben