Commit Graph

388 Commits

Author SHA1 Message Date
Ryan Holinshead
79de674508 Currently, the updateClassList function on the TextEditorComponent does not properly re-add its managed classes (editor, is-focused, mini) to the element when the element has been re-rendered with changed classes passed in. This fixes the issue by always adding the newClassList classes to the element and relying on the element.classList.add to determine if the classes already exist (and should be ignored)
Released under CC0
2018-07-13 16:45:04 -07:00
Max Brunsfeld
0148ee7d9b Always leave room for scrollbars 2018-06-07 14:42:06 -07:00
Ash Wilson
0c2f458497 Boolean logic, my old enemy 2018-04-12 14:13:38 -04:00
Ash Wilson
4e9544583b Can't use the same name for the property and method 2018-04-12 14:07:17 -04:00
Ash Wilson
1545768522 Derive the readonly attribute from model.isReadOnly() 2018-04-12 13:23:12 -04:00
Ash Wilson
6ee477a329 Disable the hidden input when the model is readOnly or keyboard disabled 2018-04-12 11:50:53 -04:00
Antonio Scandurra
26837d65b4 Clip cursor width when soft-wrap is on and cursor is at the end of line
This prevents the parent tile from disabling sub-pixel anti-aliasing.
For some reason, adding `overflow: hidden` to the cursor container
element doesn't solve the issue, so we're adding this workaround
instead.
2018-03-13 12:04:35 +01:00
Linus Eriksson
de54e55878 Fix shaking editor when typing
When using DPI scaling the scroll position could be set to a position
that
was not possible causing a scroll event to scroll back. This was causing
the editor to shake when editing. This PR fixes
this by rounding scrollTop and scrollLeft to a physical pixel instead of
rounding using Math.round

Co-authored-by: Antonio Scandurra <as-cii@github.com>
2018-03-05 17:37:30 +01:00
Nathan Sobo
e334f0419f Merge pull request #16753 from billyjanitsch/revert-15487
Stop scaling up small scroll wheel events
2018-02-16 11:58:33 -08:00
Linus Eriksson
8cfcdf8c00 Revert always return false 2018-02-15 23:12:35 +01:00
Linus Eriksson
63326e969a Unfocus test and always return false to see if this fails on circle 2018-02-15 22:53:29 +01:00
Linus Eriksson
3059d14bd7 Merge remote-tracking branch 'origin/master' into b3-failing-seed 2018-02-15 19:49:58 +01:00
Billy Janitsch
a433e974eb Stop scaling up small scroll wheel events 2018-02-15 10:42:57 -08:00
Wliu
7e0635d2c0 Fix spec 2018-01-26 18:41:57 -05:00
Wliu
be24e6edf7 Revert change to move mouse cursor on right-click 2018-01-24 11:22:41 -05:00
David Wilson
6d09a5257a Fix #16538: Middle-click pastes into read only editor on Linux
This change fixes an issue where users on Linux are able to paste into
read only TextEditors by clicking the middle mouse button.  The fix is
to check for whether the TextEditorComponent's isInputEnabled method
returns true before pasting with middle click on Linux.
2018-01-22 18:50:07 -08:00
Linus Eriksson
b7138a0410 Add these changes to the non scheduled code path 2018-01-19 19:11:16 +01:00
Linus Eriksson
e07a9a6387 Merge branch 'master' of https://github.com/atom/atom into b3-failing-seed 2018-01-19 19:08:21 +01:00
Antonio Scandurra
3fbfadde5a Don't break subpixel AA when cursor is at the end of longest line
With the Electron upgrade, something changed in the way characters are
rendered/measured, and that was causing subpixel anti-aliasing to stop
working when cursors were at the end of the longest line.

Every cursor has a width that is calculated in the following way:

* If there's a character after the cursor, the width corresponds to
width of such character.
* Otherwise, the width equals to the "base character width" measured on
a dummy line.

In the latter case, even if we were setting the width of the content
container to account for the width of such cursor, some rounding problem
was causing the cursor to be able to escape the container and thus break
subpixel anti-aliasing.

With this commit, instead of rounding the value we assign to the
container width, we will always ceil it. This ensures that cursors are
always strictly contained within the parent element and resolves the
subpixel anti-aliasing issue.
2018-01-19 11:20:53 +01:00
Antonio Scandurra
c48ba79f3c Prevent selection of non-text content in editor
Signed-off-by: Nathan Sobo <nathan@github.com>
2018-01-09 15:16:17 +01:00
Antonio Scandurra
3d21ac0742 Render highlights behind lines
This fixes a bug most likely introduced with #16511 by ensuring that UI
elements (such as selections) never cover up the text.

Signed-off-by: Nathan Sobo <nathan@github.com>
2018-01-09 15:15:54 +01:00
Nathan Sobo
4926fe466c Move highlights container into lines for theme compatibility 2018-01-08 13:16:46 -07:00
Jason Rudolph
408070e913 Set the tabIndex on the input element
This commit reverts a portion of the changes introduced in
9eac520e6a. Prior to that commit, we were
setting the tabIndex to -1 on the atom-text-editor element. This commit
restores that behavior.

Instead of setting a custom tab index directly on the atom-text-editor
element, we instead set the tabIndex on the input element *inside* the
atom-text-editor element.

With these changes in place, you can successfully use the tabIndex to
define the tab order for atom-text-editor elements. 😅
2018-01-04 14:31:11 -05:00
itsmichaelwang
e462d0d298 Fix lint issue 2018-01-04 14:23:12 -05:00
itsmichaelwang
9eac520e6a Allow you to tab through modal text box 2018-01-04 14:23:12 -05:00
Antonio Scandurra
69799d35b2 Delete Chrome 56 workarounds 2017-12-22 14:44:17 +01:00
Antonio Scandurra
8b3c3bcfcf Loosen containment rules on dummy scrollbar elements
This commit uses `content` containment (i.e. `layout paint style`) as
opposed to `strict` containment (i.e. `layout paint style size`) for
dummy scrollbar elements.

By removing `size` containment we are fixing a rendering bug that was
preventing the scrollbar from being sized correctly. This problem was
caught by a TextEditorComponent test
(https://circleci.com/gh/atom/atom/6393).
2017-12-22 14:29:22 +01:00
Wliu
1d6549a8e3 Merge pull request #16328 from atom/wl-right-click-selections
Update auxiliary click logic for moving cursors
2017-12-21 12:18:41 -05:00
Katrina Uychaco
2d6750cae3 Remove input enabled check for 'is-focused' class
vim-mode-plus relies on this behavior
2017-12-14 11:56:23 +01:00
Wliu
db392502e4 Always move the cursor on middle-click 2017-12-05 23:54:43 +01:00
Wliu
69214dc26a On clicks, only move cursor if there is one cursor without a selection 2017-12-05 23:11:45 +01:00
Katrina Uychaco
a993742f7f 👕 🔥 semicolon 2017-11-28 22:06:33 -08:00
Katrina Uychaco
aeb9af63df Store readOnly state on the TextEditor model 2017-11-28 21:14:40 -08:00
Katrina Uychaco
909caa2a59 Add 'readonly' attribute to <atom-text-editor> element 2017-11-28 20:01:31 -08:00
Wliu
3569a11574 Rework didMouseDownOnContent to always position cursor 2017-11-15 12:42:27 +01:00
Wliu
22d8ae67df Merge branch 'master' into b3-failing-seed 2017-11-12 13:27:28 +01:00
Linus Eriksson
77c685a1b7 Use wheelDelta instead of delta
In Atom 1.19 we changed the scroll handler to use deltaX and deltaY
instead of wheelDeltaX/wheelDeltaY. wheelDelta is larger so this caused
the scrolling speed to slow down. This change in speed was especially
noticable on Linux
2017-11-06 22:50:53 +01:00
Justin Ratner
7639afe684 Judge resize of overlay by contentRect changing 2017-11-02 15:13:49 -06:00
Nathan Sobo
f25570f135 Exclude Shift from keydown events that terminate selection drags 2017-11-01 14:00:43 -06:00
Nathan Sobo
11511f27d5 Don't terminate selection dragging when a modifier key is pressed
This preserves the ability to add selections via ctrl- or cmd-click.
2017-11-01 09:22:38 -06:00
Nathan Sobo
252a98b231 Prevent the browser from auto-scrolling the scroll container on spacebar 2017-10-31 13:55:40 -06:00
Max Brunsfeld
482824047c ⬆️ text-buffer 2017-10-30 17:26:21 -07:00
Nathan Sobo
5779111799 Use destroyFoldsContainingBufferPosition in more cases 2017-10-25 12:50:56 -06:00
Justin Ratner
089717cbd3 fix failing test 2017-10-20 15:46:27 -06:00
Justin Ratner
d0bdbb861b update overlay itself instead of text editor when resize occurs 2017-10-20 11:30:50 -06:00
Linus Eriksson
c1c9d3f75f Handle edits that scroll up due to hiding the horizontal scrollbar 2017-10-19 21:39:59 +02:00
Antonio Scandurra
65af9e953b Stop dragging only when user interacts with keyboard
Previously, we used to prevent the user from dragging the selection
further when the buffer was about to change. This was problematic
because any change in the buffer, even one that was performed
"automatically" by a package, would cancel the dragging action and
result in a confusing experience for the user.

On the other hand, we want to prevent users from accidentally selecting
text when they perform an edit (see #15217, #15405).

This commit addresses both concerns by canceling the dragging as soon as
the user interacts with the keyboard, instead of canceling the dragging
when the buffer is about to change.

One downside of this approach is that it changes the behavior of
pressing a keystroke that does not result in a buffer change, e.g.
Shift, Arrow Keys, etc.

Signed-off-by: Jason Rudolph <jasonrudolph@github.com>
2017-10-17 18:50:20 +02:00
Justin Ratner
0c35c26805 fix infinite overlay resizing loop 2017-10-14 19:05:54 -06:00
Antonio Scandurra
7853e3cd8c Don't throw when destroying block decorations inside marker change event 2017-10-11 09:42:53 +02:00
Antonio Scandurra
683cdeac27 Always revert to composition checkpoint, even if input is disabled
Previously, if the user opened the IME menu while input was disabled, we
would create a composition checkpoint without reverting to it after the
composition ended. When enabling input again, the first keystroke would
cause any buffer change that occurred between the IME composition and
the keystroke to be reverted.

With this commit we will always revert and delete the composition
checkpoint as soon as the composition ends, regardless of whether the
input is enabled or not.
2017-10-06 13:34:16 +02:00