Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Orion » Invisible selected text for not focused editor
Invisible selected text for not focused editor [message #870143] Mon, 07 May 2012 00:48 Go to next message
Joe Ertaba is currently offline Joe ErtabaFriend
Messages: 17
Registered: April 2012
Junior Member
Hi,

In Firefox browser, selected text is transparent when the editor does not have focus.

This is due to this code in textview.js
			if (isFirefox || isIE) {
				if (this._selDiv1) {
					var color = "transparent";
					this._selDiv1.style.background = color;
					this._selDiv2.style.background = color;
					this._selDiv3.style.background = color;
					if (window.getSelection) {
						var sel = window.getSelection();
						if (sel.rangeCount > 0) { sel.removeAllRanges(); }
					}
				}
			}


This can cause problems. For instance lets say there is a search window available. When user is directed to this window, selected text would be invisible as the editor doesn't have focus!,...
Is there any work around for this?

P.S: I know that in Scratchpad even when the editor doesn't have focus selected text is visible. I couldn't figure out how they did this. Though, the Orion structure on Scratchpad is kind of different from original one (there is one extra FRAME element,...)
Re: Invisible selected text for not focused editor [message #870265 is a reply to message #870143] Mon, 07 May 2012 14:02 Go to previous messageGo to next message
John Arthorne is currently offline John ArthorneFriend
Messages: 174
Registered: July 2009
Senior Member
See this thread which has some discussion about it:

http://dev.eclipse.org/mhonarc/lists/orion-dev/msg01498.html

I don't know if this would work in your case, but what was done in the Orion search/replace page was to do the match highlighting using the editor's annotation model rather than using the native text selection.

Hope that helps,
John
Re: Invisible selected text for not focused editor [message #870340 is a reply to message #870265] Mon, 07 May 2012 17:07 Go to previous messageGo to next message
Joe Ertaba is currently offline Joe ErtabaFriend
Messages: 17
Registered: April 2012
Junior Member
Thanks for the reply. Just one quick question, can you point me to the code for Orion search/replace page. I want to get flavor of how you have implemented it.
Re: Invisible selected text for not focused editor [message #870350 is a reply to message #870340] Mon, 07 May 2012 17:51 Go to previous messageGo to next message
John Arthorne is currently offline John ArthorneFriend
Messages: 174
Registered: July 2009
Senior Member
Here is a pointer to the commit that converted to using annotations rather than native selection for displaying search results. The interesting bit is in orionTextSearchAdaptor.js and you can see it is relatively straight-forward to plug new annotations into the editor:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?h=editorNoIFRAME&id=320f247b9f7cc2a82af3ee8d8d64806f463e3d0e
Re: Invisible selected text for not focused editor [message #870362 is a reply to message #870350] Mon, 07 May 2012 19:20 Go to previous messageGo to next message
Joe Ertaba is currently offline Joe ErtabaFriend
Messages: 17
Registered: April 2012
Junior Member
Thanks a lot!
Re: Invisible selected text for not focused editor [message #870363 is a reply to message #870350] Mon, 07 May 2012 19:20 Go to previous messageGo to next message
Joe Ertaba is currently offline Joe ErtabaFriend
Messages: 17
Registered: April 2012
Junior Member
No Message Body

[Updated on: Mon, 07 May 2012 21:23]

Report message to a moderator

Re: Invisible selected text for not focused editor [message #870364 is a reply to message #870350] Mon, 07 May 2012 19:21 Go to previous message
Joe Ertaba is currently offline Joe ErtabaFriend
Messages: 17
Registered: April 2012
Junior Member
No Message Body

[Updated on: Mon, 07 May 2012 21:23]

Report message to a moderator

Previous Topic:working around lack of project-wide validation
Next Topic:Get line number from ruler
Goto Forum:
  


Current Time: Tue Nov 25 00:58:33 GMT 2014

Powered by FUDForum. Page generated in 0.02016 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software