Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 137694

Summary: [console] scrollbar in empty console
Product: [Eclipse Project] Platform Reporter: Grzegorz Grzybek <gr.grzybek>
Component: DebugAssignee: Darin Wright <darin.eclipse>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, digulla, gr.grzybek, jpstotz
Version: 3.2   
Target Milestone: 3.3 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
empty console as if non-empty
none
patch
none
revised patch
none
scrollbar indicates more console content none

Description Grzegorz Grzybek CLA 2006-04-20 07:47:40 EDT
I have an empty console (cleared), but the vertical scrollbar indicates that there are at least several lines of text.
there is always a few lines of text after the console output
Comment 1 Grzegorz Grzybek CLA 2006-04-20 07:49:19 EDT
Created attachment 39022 [details]
empty console as if non-empty
Comment 2 Kevin Barnes CLA 2006-04-20 15:16:39 EDT
I've been unable to reproduce this. What build are you using? Can you attach a simple test case that demonstrates the behavior?
Comment 3 Grzegorz Grzybek CLA 2006-04-20 15:35:04 EDT
hmm. I've seen this behavior since at least 3.2M2 or M3... 
Console always behaves the same - run or debugged program produces output, but every line of text added increases scrollbar about 2 or 3 lines (in scrollbar meaning, not actual lines, that may be selected). After clearing the console, the extra "scrollbar" lines remains...
I'll try to use Spy++ to see what are console's properties.

I use Windows XPSP2, IE7beta2.
Comment 4 Darin Wright CLA 2006-06-13 16:29:26 EDT
3.2 RC7 

Moving to Text for comment. Not sure if this is a Text issue or perhaps SWT. Behavior can be seen by debugging the following program.

* put a breakpoint on the first line, debug to the breakpoint
(a) resume through the loop 
(b) place cursor at bottom of the console (last empty line)
(c) drag the console scroll bar as far down as it will go
(d) repeat steps a, b, c
(e) clear console output
* repeat steps a, b, c, d, e
* by iteration 9 (or so) I get a scroll bar in the console even though it is empty

Looking at our ConsoleDocumentAdapter it appears we are answering the correct number of lines, so I'm not sure why it's sizing wrong.

public class ConsoleOutput {
	
public static void main(String[] args) {
	for (int j = 0; j < 20; j++) { // BREAKPOINT
		for (int i = 0; i < 400; i++) {
			System.out.println(i + " - abcdefghijklmnopqrstuvwxyz");
		}
	}
}

}
Comment 5 Dani Megert CLA 2006-06-14 06:32:27 EDT
Works for me if I simply remove TextConsoleViewer.createDocumentAdapter() i.e. if I use the one from Platform text.

NOTE: it's not just the scroll bar: with each iteration the console text are seems to grow by 2 lines at the end. This can also be seen if you press 'Resume' without clearing the console and simply scroll to the bottom. 
Comment 6 Dani Megert CLA 2006-06-14 06:45:57 EDT
One quick bug I see is that you set the line count to 0 when there's no input - that's wrong: there's always at least the first line - see StyledTextContent for details. 

There seems to be an additional bug as well: see scenario I described in comment 5 which does not involve to clear the console.
Comment 7 Kevin Barnes CLA 2006-06-15 12:25:31 EDT
Created attachment 44547 [details]
patch
Comment 8 Kevin Barnes CLA 2006-06-21 16:02:22 EDT
Created attachment 45037 [details]
revised patch
Comment 9 Kevin Barnes CLA 2006-06-21 16:03:24 EDT
released patch to HEAD
Comment 10 Kevin Barnes CLA 2006-06-22 11:22:27 EDT
fixed in HEAD
Comment 11 Darin Wright CLA 2006-07-05 14:57:47 EDT
Verified.
Comment 12 Grzegorz Grzybek CLA 2006-08-29 06:50:40 EDT
Created attachment 48950 [details]
scrollbar indicates more console content

I've checked this problem in Eclipse 3.3M1 (with WTP I200608260752-200608260752) and there still is the same problem with scrollbar in console view.
After few simple for loops, there seems to be more and more lines in console - after clearing the view, the scrollbar still indicates some contents.
Comment 13 Grzegorz Grzybek CLA 2006-08-29 06:52:32 EDT
I think the problem is still present in 3.3M1 (Windows XP SP2, Internet Explorer 7RC1).
Comment 14 Grzegorz Grzybek CLA 2006-11-09 09:46:11 EST
I think, that in Eclipse 3.3m3 it works correctly...
Comment 15 Darin Wright CLA 2006-12-01 09:19:50 EST
*** Bug 166454 has been marked as a duplicate of this bug. ***
Comment 16 Darin Wright CLA 2007-01-30 12:49:39 EST
*** Bug 171547 has been marked as a duplicate of this bug. ***