Fixes the specified scrolling problem in MVC.
There is a little bit of risk with this, since Morphic uses this method too. But the fix itself looks reasonable.
- Doug
On Thursday, April 29, 2004, at 08:10 AM, Boris Gaertner wrote:
Hello, earlier this day I posted a mail with a list of bugs that I think should be fixed before we close 3.7. For one of these bugs, no fix has been proposed so far.
I am therefore really happy to offer a problem analysis and a fix for the bug that is registered under BFAV archive ID 14350, posted at Nov 26, 2003. For quite a time, I was only able to hack around a problem that I did not understand, but now I think I have found was goes wrong. Here is the bug description again: ( from the cited bug report)
In an MVC project, open a file list and select a text file. Place the cursor into the text view (at the beginning of the text) and scroll down with the down arrow. When you reach the end of the text, you will get a notifier with the message as soon as you release the 'arrow down' key:
MessageNotUnderstood: UndefinedObject>>first
This comes from ParagraphEditor>>sameColumn:newLine:forward:,
And here is an analysis of the bug:
In method
ParagraphEditor>>sameColumn: start newLine: lineBlock forward: isForward
we read:
targetLineNumber _ ((lineBlock value: currentLineNumber) max: 1) min: lines size.
where lines is a temporary variable of the method. Under some circumstances, the method fetches the lines from the paragraph that is edited. (The paragraph is an instance of Paragraph in MVC and an instance of NewParagraph in Morphic) Under different circumstances, sameColumn:lineBlock:forward: computes an array of lines (this is done by ParagraphEditor>>lines).
In NewParagraph, 'lines' is used under an exact fit policy: For a paragraph that is composed to be displayed in n lines, the size of the array is n .
In a Paragraph, 'lines' is an array of TextLineIntervals. In Paragraph, the array 'lines' is used under a "keep additional space" policy and the correct number of lines is stored in instance variable 'lastLine' and can be accessed with the method Paragraph>>numberOfLines
When sameColumn:lineBlock:forward: computes an array of lines, it can use 'lines size' to obtain the number of lines, but when it uses the lines from the paragraph, it has to use 'paragraph numberOfLines' to obtain the number of lines.
Solution:
To handle both cases, I use an additional instance variable to keep the number of lines.
I would be glad to see this fix in the final 3.7 (if that is still possible), so can some fellow with an interest in MVC please review my proposal?
Thank you a lot! Boris<MVCCursorDownFix.1.cs>