Bug 287303 - [patch] Add Word Wrap action to Console View
Summary: [patch] Add Word Wrap action to Console View
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 enhancement with 7 votes (vote)
Target Milestone: 4.5 M1   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy
: 35745 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-08-21 10:25 EDT by Gaetano Santoro CLA
Modified: 2016-04-16 10:02 EDT (History)
17 users (show)

See Also:


Attachments
ConsoleViewWordWrapPatch (3.56 KB, patch)
2009-08-21 10:25 EDT, Gaetano Santoro CLA
no flags Details | Diff
word wrap screenshot (17.86 KB, image/png)
2009-08-21 10:27 EDT, Gaetano Santoro CLA
no flags Details
word wrap icon preview in PNG format (711 bytes, image/png)
2014-02-14 13:27 EST, Matthias Mailänder CLA
no flags Details
screenshot of the latest revision (34.44 KB, image/png)
2014-02-22 09:52 EST, Matthias Mailänder CLA
no flags Details
Word Wrap is now part of output group, right next to scroll lock (19.04 KB, image/png)
2014-03-29 05:43 EDT, Matthias Mailänder CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gaetano Santoro CLA 2009-08-21 10:25:48 EDT
Created attachment 145268 [details]
ConsoleViewWordWrapPatch

the attached patch add Word Wrap action to Console View
Comment 1 Gaetano Santoro CLA 2009-08-21 10:27:03 EDT
Created attachment 145269 [details]
word wrap screenshot

added screenshot
Comment 2 Sorin Sbarnea CLA 2010-06-16 08:57:15 EDT
Any news regarding this *old* issue?
Comment 3 Pawel Piech CLA 2011-06-07 17:15:01 EDT
Duplicate.

*** This bug has been marked as a duplicate of bug 35745 ***
Comment 4 Jacques Le Roux CLA 2012-06-03 06:53:46 EDT
I like it, why has it never considered and marked as duplicate of bug 35745 when nobody never worked on bug 35745?
Comment 5 Remy Suen CLA 2012-06-03 07:52:49 EDT
(In reply to comment #4)
> I like it, why has it never considered and marked as duplicate of bug 35745
> when nobody never worked on bug 35745?

I can't speak for why it was "never considered", but as to your duplication question, this process is the norm for projects hosted at Eclipse.org.

Both bugs are talking about the same issue and so the one created later was marked as a duplicate of the earlier one.
Comment 6 Jacques Le Roux CLA 2012-06-03 08:13:07 EDT
Makes sense but then I hope someone will one day considers the effort done. I makes me feel like it's wasted...
Comment 7 Remy Suen CLA 2012-06-03 09:01:08 EDT
(In reply to comment #6)
> Makes sense but then I hope someone will one day considers the effort done. I
> makes me feel like it's wasted...

I am not sure I understand what you are saying here. What is "wasted"?
Comment 8 Jacques Le Roux CLA 2012-06-03 14:14:00 EDT
It seems to me that nobody never tried to review and test the attached patch. Since it's already almost 3 years the work done by Gaetano Santoro seems wasted. That's what I meant. 

Also the fact that this bug report is marked as duplicate makes me wonder if the committer/s assigned to the referenced bug is/are aware of the existence of this patch...
Comment 9 Remy Suen CLA 2012-06-03 16:51:43 EDT
(In reply to comment #8)
> It seems to me that nobody never tried to review and test the attached patch.
> Since it's already almost 3 years the work done by Gaetano Santoro seems
> wasted. That's what I meant. 

Ah, I see. My mistake. I did not even realize there was a patch to this bug since I was only reading the newest comments.
Comment 10 Curtis Windatt CLA 2012-06-04 09:59:28 EDT
I will reopen this bug.  When cleaning up the duplicate reports we must have not seen the patch (so the oldest report is kept).  I don't know if this is something we have time to review for 4.3.
Comment 11 Curtis Windatt CLA 2012-06-04 10:00:23 EDT
*** Bug 35745 has been marked as a duplicate of this bug. ***
Comment 12 Ahmed ElMehri CLA 2013-05-31 06:45:23 EDT
Can anyone tell me how to apply the patch? thank you in advance.
Comment 13 Curtis Windatt CLA 2013-05-31 10:17:46 EDT
(In reply to comment #12)
> Can anyone tell me how to apply the patch? thank you in advance.

Copy the patch to your clipboard or save it locally.  Right click on a project, apply patch...
Comment 14 Matthias Mailänder CLA 2014-01-17 16:53:45 EST
Nice patch. Still works! Rebased onto Luna and added to https://git.eclipse.org/r/20776 code review. Done as part of the https://wiki.eclipse.org/Hackathon_Hamburg_2013 

I added Gaetano Santoro as author in the copyright header as the is less than 250 lines and was contributed before we had the CLA.
Comment 15 Matthias Mailänder CLA 2014-01-20 09:57:40 EST
Gaetano can you sign the CLA, see http://www.eclipse.org/legal/clafaq.php as you are the original author and I am just the patch committer. This is currently holding of the review process.
Comment 16 Gaetano Santoro CLA 2014-01-20 10:10:37 EST
signed

Thanks
Gaetano
Comment 17 Matthias Mailänder CLA 2014-01-20 10:49:36 EST
I am still getting request rejected

"Authored by: Gaetano Santoro
error: The author does not have a Gerrit account.
All authors must either be a commiter on the project, or have a current CLA on file.
Please see http://wiki.eclipse.org/CLA"

This may be a timing/cache issue. However just to make sure: can you login to http://git.eclipse.org/c/ to create a Gerrit account? You will need this anyway to submit patches directly in the future.
Comment 18 Michael Rennie CLA 2014-01-22 10:09:37 EST
(In reply to Matthias Mailänder from comment #17)
> I am still getting request rejected

The gerrit link: https://git.eclipse.org/r/#/c/20776/

Review comments:

1. The new action does not need to be API - should be moved to the org.eclipse.ui.internal.console package.

2. I would prefer the action to be a toolbar action so users get reminded that they have the setting turned on.

3. It would be better to use the new menus extension point for contributing a command / handler / toolbar button
Comment 19 Lars Vogel CLA 2014-01-22 10:21:15 EST
(In reply to Michael Rennie from comment #18)

> 2. I would prefer the action to be a toolbar action so users get reminded
> that they have the setting turned on.

Can you suggest an icon we should use?

> 3. It would be better to use the new menus extension point for contributing
> a command / handler / toolbar button

I think all the other contributions are based on the old one, I think for consistency this new contribution should use the same approach.
Comment 20 Michael Rennie CLA 2014-01-22 11:36:30 EST
(In reply to Lars Vogel from comment #19)
> (In reply to Michael Rennie from comment #18)
> 
> > 2. I would prefer the action to be a toolbar action so users get reminded
> > that they have the setting turned on.
> 
> Can you suggest an icon we should use?
> 

How about this one: platform:/plugin/org.eclipse.ui.workbench.texteditor/icons/full/etool16/block_selection_mode.gif

> > 3. It would be better to use the new menus extension point for contributing
> > a command / handler / toolbar button
> 
> I think all the other contributions are based on the old one, I think for
> consistency this new contribution should use the same approach.

The goal is to remove all of the deprecated contributions, so adding more of them does help that end. See bug 390869.
Comment 21 Lars Vogel CLA 2014-01-22 15:41:07 EST
(In reply to Michael Rennie from comment #20)

Updated Gerrit review to address 1.) and 2.). I had to change the author tag in the commit, as I got the message that I'm not allowed to push as non committer on behave of others.

> The goal is to remove all of the deprecated contributions, so adding more of
> them does help that end. See bug 390869.

I didn't find the time to do this. Maybe Gaetano or someone else can help here?
Comment 22 Dani Megert CLA 2014-01-23 02:46:13 EST
(In reply to Michael Rennie from comment #18)
> (In reply to Matthias Mailänder from comment #17)
> > I am still getting request rejected
> 
> The gerrit link: https://git.eclipse.org/r/#/c/20776/
> 
> Review comments:

Mike, it would make sense to add review comments that apply to a concrete Gerrit change directly in Gerrit, or at least add a comment in Gerrit that you made comments in the bug report. I was confused to see new patch sets coming for the change in Gerrit without any explanation/reason.
Comment 23 Dani Megert CLA 2014-01-23 02:48:24 EST
(In reply to Michael Rennie from comment #20)
> > I think all the other contributions are based on the old one, I think for
> > consistency this new contribution should use the same approach.
> 
> The goal is to remove all of the deprecated contributions, so adding more of
> them does help that end. See bug 390869.

I disagree. We should stay consistent with what we have. That makes the code easier to understand. Plus, I don't see us doing bug 390869 - we have more important/interesting work to do.
Comment 24 Gaetano Santoro CLA 2014-01-23 03:49:45 EST
(In reply to Lars Vogel from comment #21)
> (In reply to Michael Rennie from comment #20)
> 
> Updated Gerrit review to address 1.) and 2.). I had to change the author tag
> in the commit, as I got the message that I'm not allowed to push as non
> committer on behave of others.
> 
> > The goal is to remove all of the deprecated contributions, so adding more of
> > them does help that end. See bug 390869.
> 
> I didn't find the time to do this. Maybe Gaetano or someone else can help
> here?

Hi All,

at the moment I'm a little busy with test/validation, so I can do this in the coming months.

However, if there are many contributions using the deprecated approch, having this one converted don't change much.

If it is not urgent I will do this in the coming months.
Comment 25 Lars Vogel CLA 2014-01-23 05:07:48 EST
(In reply to Dani Megert from comment #23)
> (In reply to Michael Rennie from comment #20)
> > > I think all the other contributions are based on the old one, I think for
> > > consistency this new contribution should use the same approach.
> > 
> > The goal is to remove all of the deprecated contributions, so adding more of
> > them does help that end. See bug 390869.
> 
> I disagree. We should stay consistent with what we have. That makes the code
> easier to understand. Plus, I don't see us doing bug 390869 - we have more
> important/interesting work to do.

If that is the case, I think the contribution is ready for review. I move the menu to the toolbar and added an icon as Michael suggested.
Comment 26 Dani Megert CLA 2014-01-30 09:28:21 EST
(In reply to Michael Rennie from comment #20)
> (In reply to Lars Vogel from comment #19)
> > (In reply to Michael Rennie from comment #18)
> > 
> > > 2. I would prefer the action to be a toolbar action so users get reminded
> > > that they have the setting turned on.
> > 
> > Can you suggest an icon we should use?
> > 
> 
> How about this one:
> platform:/plugin/org.eclipse.ui.workbench.texteditor/icons/full/etool16/
> block_selection_mode.gif

That's a no go. We should not use the same icon for two different things. Especially, not when both are showing text and allow selection.
Comment 27 Matthias Mailänder CLA 2014-02-10 16:07:33 EST
I created a wordwrap icon https://git.eclipse.org/r/#/c/21787/
Comment 28 Dani Megert CLA 2014-02-11 07:03:04 EST
(In reply to Matthias Mailänder from comment #27)
> I created a wordwrap icon https://git.eclipse.org/r/#/c/21787/

Can you also provide the GIF? We might switch to SVG at some point, but currently all icons are GIFs in ui.console.
Comment 29 Lars Vogel CLA 2014-02-11 07:18:03 EST
(In reply to Dani Megert from comment #28)
> (In reply to Matthias Mailänder from comment #27)
> > I created a wordwrap icon https://git.eclipse.org/r/#/c/21787/
> 
> Can you also provide the GIF? We might switch to SVG at some point, but
> currently all icons are GIFs in ui.console.

If you are OK with the icon, I create a png file for it via the SVG to png generator.
Comment 30 Dani Megert CLA 2014-02-11 09:59:31 EST
(In reply to Lars Vogel from comment #29)
> (In reply to Dani Megert from comment #28)
> > (In reply to Matthias Mailänder from comment #27)
> > > I created a wordwrap icon https://git.eclipse.org/r/#/c/21787/
> > 
> > Can you also provide the GIF? We might switch to SVG at some point, but
> > currently all icons are GIFs in ui.console.
> 
> If you are OK with the icon, I create a png file for it via the SVG to png
> generator.

Yes please. I think it could work, but need to see it live for a final "go".
Comment 31 Matthias Mailänder CLA 2014-02-14 13:27:18 EST
Created attachment 239961 [details]
word wrap icon preview in PNG format

See https://git.eclipse.org/r/#/c/21787/ for the source SVG.
Comment 32 Lars Vogel CLA 2014-02-17 13:54:40 EST
(In reply to Matthias Mailänder from comment #31)
> Created attachment 239961 [details]
> word wrap icon preview in PNG format
> 
> See https://git.eclipse.org/r/#/c/21787/ for the source SVG.

Thanks. Icon added to org.eclipse.ui.images with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=5278f7b48ece0fb02947eb6ffc47d1fa50fa1917
Comment 33 Lars Vogel CLA 2014-02-21 15:23:04 EST
https://git.eclipse.org/r/#/c/20776/ has been updated and awaits feedback.
Comment 34 Matthias Mailänder CLA 2014-02-22 09:52:14 EST
Created attachment 240228 [details]
screenshot of the latest revision

Looks better with a button. Thanks Lars.
Comment 35 Dani Megert CLA 2014-02-27 06:54:22 EST
(In reply to Matthias Mailänder from comment #34)
> Created attachment 240228 [details]
> screenshot of the latest revision
> 
> Looks better with a button. Thanks Lars.

Indeed, but as said before, we need them as GIFs.
Comment 36 Lars Vogel CLA 2014-02-27 08:13:22 EST
(In reply to Dani Megert from comment #35)
> (In reply to Matthias Mailänder from comment #34)
> > Created attachment 240228 [details]
> > screenshot of the latest revision
> > 
> > Looks better with a button. Thanks Lars.
> 
> Indeed, but as said before, we need them as GIFs.

PNG should be OK, right? We anyhow want to migrate to PNG.
Comment 37 Dani Megert CLA 2014-02-27 11:22:09 EST
(In reply to Lars Vogel from comment #36)
> (In reply to Dani Megert from comment #35)
> > (In reply to Matthias Mailänder from comment #34)
> > > Created attachment 240228 [details]
> > > screenshot of the latest revision
> > > 
> > > Looks better with a button. Thanks Lars.
> > 
> > Indeed, but as said before, we need them as GIFs.
> 
> PNG should be OK, right? We anyhow want to migrate to PNG.

It will be OK, but having a mix is not good. So, you can either wait with this bug until converted to PNG or deliver the GIF. Probably the former, given there's still work to do after Mike's review.
Comment 38 Matthias Mailänder CLA 2014-03-27 10:59:24 EDT
What is holding this up? Do we need to convert more icons from GIF to PNG?
Comment 39 Michael Rennie CLA 2014-03-27 11:24:41 EDT
(In reply to Matthias Mailänder from comment #38)
> What is holding this up? Do we need to convert more icons from GIF to PNG?

The enablement / visibility / preference state of the action does not work. See my review comments on patch set 6.
Comment 40 Matthias Mailänder CLA 2014-03-29 05:43:09 EDT
Created attachment 241414 [details]
Word Wrap is now part of output group, right next to scroll lock

Okay I rewrote it in patch set 7 to match the way the other buttons (took scroll lock as a template) are integrated. This also fixes the problem that a non-functional button is shown on empty consoles.
Comment 41 Matthias Mailänder CLA 2014-03-29 07:34:26 EDT
https://git.eclipse.org/r/#/c/20776/
Comment 42 Michael Rennie CLA 2014-03-31 11:29:09 EDT
(In reply to Matthias Mailänder from comment #40)
> Created attachment 241414 [details]
> Word Wrap is now part of output group, right next to scroll lock
> 
> Okay I rewrote it in patch set 7 to match the way the other buttons (took
> scroll lock as a template) are integrated. This also fixes the problem that
> a non-functional button is shown on empty consoles.

Looks much better now.

There is however one major remaining issue (and few small ones listed below): the console does not wrap output for successive consoles automatically.

Steps:

1. create an IOConsole and check on the word wrap option. If there is any overly long output in the console it will be wrapped (GOOD)

2. run the following snippet:

package console.test;

public class FloodConsole {

	public static void main(String[] args) {
		for(int i = 0; i < 100000; i++) {
			System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); //$NON-NLS-1$
		}
	}
}

notice that the word wrap action is still checked on (maintained its state - GOOD) but that the output is not wrapped (BAD)

3. If you toggle the action the output from the above snippet will be wrapped 

I took a quick peak at the code and there are few additional things:
1. IOConsolePage#createActions, is missing a call to #setWordWrap
2. ConsoleView#showPageRec, is missing a call to IOConsolePage#setWordWrap (at the end of the method)
3. The state set in IOConsoleViewer is not used
4. IOConsoleViewer#isWordWrap is not used
Comment 43 Matthias Mailänder CLA 2014-04-04 11:37:33 EDT
Fixed the inconsistencies in https://git.eclipse.org/r/#/c/20776/7..8/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java,unified and following, but I think it still does not memorize the previous word wrap setting. Read through the console code, but I am not sure where I am missing a hook.
Comment 44 Michael Rennie CLA 2014-07-14 14:30:33 EDT
(In reply to Matthias Mailänder from comment #43)
> Fixed the inconsistencies in
> https://git.eclipse.org/r/#/c/20776/7..8/org.eclipse.ui.console/src/org/
> eclipse/ui/internal/console/ConsoleView.java,unified and following, but I
> think it still does not memorize the previous word wrap setting. Read
> through the console code, but I am not sure where I am missing a hook.

Looks like the successive console hook you are missing is in IOConsoleViewer#setWordWrap, you have to add the following:

getTextWidget().setWordWrap(wordwrap);

Also, I found that some places you invert the value of word wrap from the checked state of the action, but you don't need to - I guess when you looked at the scroll lock example you just copied the same behavior? In the scroll lock case, if the action is checked autoscrolling is false, in the wordwrap case if the action is checked wrapping is true.

in ConsoleView:

- ((IOConsolePage)page).setWordWrap(!fWordWrap);
+ ((IOConsolePage) page).setWordWrap(fWordWrap);

in IOConsolePage:

- fWordWrapAction.setChecked(!wordwrap);
+ fWordWrapAction.setChecked(wordwrap);

- setWordWrap(!fWordWrapAction.isChecked());
+ setWordWrap(fWordWrapAction.isChecked());

in IOConsoleViewer

- private boolean fWordWrap = true;
+ private boolean fWordWrap = false;
Comment 45 Matthias Mailänder CLA 2014-07-27 03:46:11 EDT
Thanks for the help. I definitely lost an overview on the inverted scroll lock and the modular approach over so many files. Updated https://git.eclipse.org/r/#/c/20776/
Comment 46 Michael Rennie CLA 2014-07-28 12:28:07 EDT
(In reply to Matthias Mailänder from comment #45)
> Thanks for the help. I definitely lost an overview on the inverted scroll
> lock and the modular approach over so many files. Updated
> https://git.eclipse.org/r/#/c/20776/

Merged with: http://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=2fd676ca07dc7f2cf5d9f0e74d312b15e665b067

Updated bundle versions / copyright headers, etc with: 

http://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=a706cd47189727205482922c03b0bc31da7680a7
Comment 47 Sarika Sinha CLA 2014-08-07 13:19:36 EDT
Verified using
Eclipse SDK

Version: Mars (4.5)
Build id: I20140806-2000
Comment 48 Konstantin F. CLA 2016-04-12 16:32:59 EDT
If I check the "Word Wrap" and restart eclipse, it's gone. Has someone considered to introduce this as permanent setting in Preferences -> Run/Debug -> Console? Or just simpler, serialize the flag in the workspace to ws\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.debug.ui.prefs

Would this make sense? For me it's annoying that flag needs to be set each time I start eclipse :(
Comment 49 Sarika Sinha CLA 2016-04-12 23:33:19 EDT
(In reply to Konstantin F. from comment #48)
> If I check the "Word Wrap" and restart eclipse, it's gone. Has someone
> considered to introduce this as permanent setting in Preferences ->
> Run/Debug -> Console? Or just simpler, serialize the flag in the workspace
> to
> ws\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.debug.
> ui.prefs
> 
> Would this make sense? For me it's annoying that flag needs to be set each
> time I start eclipse :(

Please create an enhancement which we can consider for 4.7 based on other inputs.
Comment 50 Konstantin F. CLA 2016-04-16 10:02:29 EDT
I've created a feature request: 491853