-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change selection drawing. #322
Conversation
Selection is drawn as highlight rectangles behind the text. There are at most three rectangles drawn - one for the first partial line, one for the last partial line, and one for the block of lines in between. Selection is now true block selection, where the highlight extends to the right edge of the window.
This is interesting! I'll have to do a deeper review before I merge it, though, which I won't get to until next week. |
Merged, with a rather invasive set of revisions made in 21d8d39 . Please test! |
Seem like the LESS mode fails. |
There are two issues with themes:
The second issue is the reason why the LESS mode demo fails to show the Everything else looks good so far! I'll do more testing on different Glenn |
Pushed some things that seem to fix these in 6a00b5c |
Go to: http://codemirror.net/demo/theme.html |
Other than the issue Peter mentioned, everything else looks good. I tried Chrome, Firefox, Safari, IE8 & IE9. |
I did find one more issue:
Eventually the scrolling will stop and you will not be able to move the selection up any more. Note that this can be a bit hard to reproduce, but seems to happen more quickly when you keep moving the mouse while the text is scrolling. |
I was able to experience this only once. Just before I reported. Edit: the 2 lines are supposed to hang over..... |
Pushed two more patches that (seem to) address the drag-select and theme-change issues. |
Go to: http://codemirror.net/demo/folding.html |
That is mostly by design, and worked the same before this change -- bounds of the selection can not sit in hidden lines. Though it did behave in a kind of surprising way by putting the cursor somewhere in the middle of the line after the hidden block, rather than at the start. I've pushed a patch to fix that. |
Go to: http://codemirror.net/demo/theme.html The drag selection bug is fixed! |
You say 'bounces around' -- does it move more than a single pixel for you? This seems hard to work around. I initially set a width on the selection DIVs, which would cause similar behavior to happen when the start of the selection (on the same line as the end) was moved. The source of this appears to be rounding errors, where browsers report offsets in whole pixels but actually sub-pixel render them. One workaround would be to overlay the colored selection with another white DIV, with both having a |
It's definitely moving more than one pixel for me. If I resize the window quickly, I can get it to move about 50 pixels. It is most noticeable on WebKit browsers (Chrome, Safari). I've only tested OSX. |
Found another bug. Edit: found in Canaray W7 Edit: focus also happens when right clicking the editor |
Well, when tabindex is removed the "bug" disappears. So it's not a related to the new drawing method. |
Selection is drawn as highlight rectangles behind the text. There are at most three rectangles drawn - one for the first partial line, one for the last partial line, and one for the block of lines in between. Selection is now true block selection, where the highlight extends to the right edge of the window.
The attached code is covered by the MIT license as follows.
Copyright ©2012 Adobe Systems Incorporated. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.