Commit Graph

4348 Commits

Author SHA1 Message Date
Nathan Sobo
548018e9b2 Add spec for onDidRemoveItem observers when moving items to other panes 2014-08-28 11:43:07 -06:00
Nathan Sobo
9bd2eec4bc Add Pane::onDidMoveItem() 2014-08-28 11:43:07 -06:00
Nathan Sobo
b8fcbe9451 Start adding event subscription methods to pane
This branch uses EventKit, an ultra-simple library for implementing
events. The object implementing the methods maintains its own emitter
object rather than doing a mixin like Emissary encourages. This will
make it easier for us to deprecate ::on on the object itself. Unlike
emissary, the EventKit Emitter implements a super minimalistic API that
only allows one value to be emitted and always returns a Disposable
from subscriptions.
2014-08-28 11:43:06 -06:00
Ivan Zuzak
861dff107a 💄 simplify assignment using coffeescript magic 2014-08-28 19:42:59 +02:00
Nathan Sobo
ebb02bcd37 Use public getters instead of properties in pane-spec 2014-08-28 11:42:42 -06:00
Ivan Zuzak
096255f283 Support built-in context menu items 2014-08-27 13:54:55 +02:00
Kevin Sawicki
e8cd59eaef Waits for reloaded event from ThemeManager
Previously disabling a theme wouldn't wait for the full reload
to finish since and the spec would intermittently fail because
the promise was fulfilled after the spec completed and the
subscription was leaked.
2014-08-26 14:23:20 -07:00
Nathan Sobo
3371ceadf3 Add regression coverage for remeasuring characters w/ requested update
The problem here is that the lines in the editor no longer reflect the
lines on screen, but we're looking for line nodes corresponding to the
editor's current contents.
2014-08-25 18:16:38 -06:00
Ben Ogle
cef24a3979 Remove the react editor options 2014-08-25 12:15:34 -07:00
Ben Ogle
3d2d8c491f rename react-editor-view -> editor-view 2014-08-25 12:07:48 -07:00
Ben Ogle
97bcdcc9b0 Rename ReactEditorView -> EditorView 2014-08-25 12:05:55 -07:00
Ben Ogle
431fab1a43 Remove the editor-view 2014-08-25 12:05:10 -07:00
Ben Ogle
f8026bb005 Require the react-editor-view where we require the editor-view 2014-08-25 12:02:38 -07:00
Ben Ogle
c3c91ae6c3 Only emit the marker-created event when the marker exists
This caused problems in the case of find-and-replace:select-all with 
multiple editors into the same file. 

* a marker is created on the TextBuffer capturing the selection
* DisplayBuffer:create-marker is fired from the first DisplayBuffer. 
The marker is turned into a selection which is merged into the current 
selection, deleting the marker that was created.
* DisplayBuffer::handleBufferMarkerCreated is called on the second
DisplayBuffer. The marker has been destroyed at this point, so it emits 
DisplayBuffer:create-marker with undefined. 
* ERROR>

Closes #3364
2014-08-25 11:42:44 -07:00
Kevin Sawicki
ecf237697b Add react editor view spec for data grammar attrs 2014-08-25 10:22:44 -07:00
Thomas Johansen
4dc89f1b1e 🐛 Fix incorrect assertions 2014-08-24 14:14:26 +02:00
Thomas Johansen
dc55d42491 Add test to verify implementation 2014-08-24 10:17:26 +02:00
Nathan Sobo
a71a524ec7 Rework DOM measurement to try to prevent measurement errors
* Simplify scrollbar refresh and measurement by using imperative DOM
  manipulation instead of React to hide/show scrollbars.
* Rename `::performInitialMeasurement` to `::becameVisible`
* Break `::checkForVisibilityChange` out of `::pollDOM` and use it in
  to check for the element becoming visible in `componentWillUpdate`.
* Don't rely on stored visibility state anywhere. Always check again.
  This could potentially be cached for an update cycle but being wrong
  about this is disastrous so I'm being conservative.
2014-08-21 17:50:46 -06:00
Ben Ogle
26d696a93d Add classes to the workspace for themes
Fixes #3097
2014-08-21 11:53:10 -07:00
Ben Ogle
30aa47026d Do not move cursor when interacting with horiz scrollbar
Fix #3284
2014-08-21 10:40:16 -07:00
Nathan Sobo
5cb084d568 Fix editor:move-to-first-character-of-line with leading hard tabs
Fixes #3314
2014-08-19 11:50:04 -06:00
Kevin Sawicki
0eaec57f7b Merge pull request #3116 from maschs/ms-srcLint
coffeelint!
2014-08-15 13:52:15 -07:00
Nathan Sobo
6c52bcf20c Assign ::firstNonWhitespace/TrailingWhitespaceIndex in Token::split
Fixes #3277
2014-08-15 12:58:27 -06:00
Ben Ogle
919f541685 Merge pull request #3261 from atom/bo-default-react-mini
Default to the react mini editors
2014-08-15 11:16:28 -07:00
Nathan Sobo
2bd8456923 Preserve invisibles in editor model across serialization
Fixes #3281
2014-08-15 08:18:53 -06:00
Maximilian Schüßler
cbe5593381 Do not use "-> return" to mark empty function 2014-08-14 19:42:50 +02:00
Maximilian Schüßler
32e59ce238 Cleanup code according to coffeelint 2014-08-14 19:41:49 +02:00
Kevin Sawicki
776e431cc5 confirmCheckoutHead -> confirmCheckoutHeadRevision 2014-08-13 19:02:09 -07:00
Kevin Sawicki
00170804e5 Remove spec now covered in git spec 2014-08-13 18:51:19 -07:00
Kevin Sawicki
3ce641f53b Move checkout head editor specs to git spec 2014-08-13 18:51:19 -07:00
Nathan Sobo
20daed176b Don't show invisibles in mini editors
This moves observation of the config keys to Editor, which assigns the
invisibles hash or null on the TokenizedBuffer via the DisplayBuffer to
control whether we render invisibles or not.
2014-08-13 16:32:14 -06:00
Nathan Sobo
d37cfb9042 Assign default invisible character glyphs via config defaults
This commit also extends config.get to merge default values into the
returned object if both the assigned and default values are objects.
This allows 'atom.invisibles' to be treated as an object that always has
the default values filled in.
2014-08-13 16:32:13 -06:00
Nathan Sobo
986753981d Use config defaults to assign default invisible characters 2014-08-13 16:32:13 -06:00
Nathan Sobo
970bde9361 Run animation frame after toggling invisibles in EditorComponent spec 2014-08-13 16:31:40 -06:00
Nathan Sobo
7b55946abf Make Editor::moveCursorToFirstCharacterOfLine work with invisible chars 2014-08-13 16:31:40 -06:00
Nathan Sobo
c74f6bb615 Remove handling of invisibles from EditorComponent 2014-08-13 16:31:40 -06:00
Nathan Sobo
63f2ab3088 Render end-of-line invisibles based on state of TokenizedLine 2014-08-13 16:31:39 -06:00
Nathan Sobo
742ec6df0d Determine the endOfLineInvisibles for each TokenizedLine 2014-08-13 16:31:39 -06:00
Nathan Sobo
864f9bc2b4 Preserve hasLeading/TrailingWhitespace when copying lines w/ invisibles
This fixes the styling of the leading whitespace of folded lines
2014-08-13 16:31:39 -06:00
Nathan Sobo
73896d100e Add specs for firstNonWhitespaceIndex and firstTrailingWhitespaceIndex 2014-08-13 16:31:39 -06:00
Nathan Sobo
193001d793 Assign invisibles via config in editor-view-spec 2014-08-13 16:31:39 -06:00
Nathan Sobo
052f9580f2 Render correct classes on leading/trailing whitespace spans 2014-08-13 16:31:39 -06:00
Nathan Sobo
2daf70f0e5 Handle invisibles at the token level to fix char width measurement
Fixes #3188
2014-08-13 16:31:39 -06:00
Kevin Sawicki
fca9ed07e6 Merge pull request #3169 from lee-dohm/ld-checkout-head
Add confirmation dialog to checkoutHead
2014-08-13 15:24:06 -07:00
Ben Ogle
e725a8ffeb Default to on in the specs 2014-08-13 14:51:05 -07:00
Ben Ogle
449da91216 Add toShow matcher 2014-08-13 13:42:46 -07:00
Ben Ogle
96804096e9 Fix specs 2014-08-12 15:44:58 -07:00
Ben Ogle
722d8cb48b Need to return a range when the text is inserted 2014-08-12 15:30:19 -07:00
Ben Ogle
b037395551 Add will-insert-text and did-insert-text to insertText() 2014-08-12 15:28:26 -07:00
Ben Ogle
7de2ad34aa Remove opaque backgrounds on mini editors
Fixes #3239
2014-08-12 14:53:09 -07:00
Kevin Sawicki
59d62d48db Remove views and destroy project during unload 2014-08-12 08:49:28 -07:00
Kevin Sawicki
16d2e41309 Use beforeunload instead of unload
unload is asynchronous in Chrome 36 and so saving the state while
reloading may not happen before the state is read on the new render
process.
2014-08-12 08:49:28 -07:00
Lee Dohm
d6a8217e94 Add config option for checkoutHead confirmation
Per the discussion with @kevinsawicki in #3168, I have added a config
option `editor.confirmCheckoutHead` that defaults to `true`. When the
`editor:checkout-head-revision` command is executed, a confirmation
dialog now shows that states which file is to be reverted and asks the
user to "Revert" or "Cancel". If the config option is set to `false`,
the old behavior, simply reverting without prompting, is used.

I also added tests to ensure that the confirmation dialog is displayed
or not in the right configurations.
2014-08-12 00:19:47 -07:00
Kevin Sawicki
f447781e01 Allow any bundled theme when in safe mode
Check enabled names against the bundled names and ensure
one bundled UI and one bundled syntax theme are enabled,
defaulting to the dark themes when necessary.
2014-08-11 15:24:49 -07:00
Maximilian Schüßler
c2304e1124 Fix indentation 2014-08-08 19:59:45 +02:00
Maximilian Schüßler
b463d9d876 Load the default themes in safe mode 2014-08-05 13:32:16 +02:00
Nathan Sobo
7e45ffa4c3 Center around the cursor in Editor::scrollToCursorPosition by default
Fixes #3131
2014-08-04 11:58:07 -06:00
Kevin Sawicki
f7187f1d5a Spy on atom.inDevMode() 2014-07-31 08:42:31 -07:00
Nathan Sobo
a9bd061144 Un-f 2014-07-29 16:52:21 -06:00
Nathan Sobo
837eaccd16 Remove extra nextAnimationFrame call 2014-07-28 21:53:18 -06:00
Nathan Sobo
bd77a02207 Measure DOM in EditorComponent when a stylesheet is updated 2014-07-28 21:00:15 -06:00
Nathan Sobo
eebbb99fc8 Handle editor font config options with a global stylesheet
Previously, each editor observed font-related config values on its own
and applied inline styles to honor them. This made it difficult to style
the editor like a normal element with CSS.

Moving this to a global stylesheet that targets editors via the .editor
selector means that the font size setting can be overridden in specific
contexts, such as when using mini editors.
2014-07-28 21:00:15 -06:00
Nathan Sobo
393552a4b6 Take cursors off the GPU and position them on the lines layer
The compositor overhead is not worth it.
2014-07-27 11:47:33 -06:00
Nathan Sobo
444c18be34 Stop polling when an update is pending 2014-07-27 11:46:22 -06:00
Nathan Sobo
dca096b8e3 Use requestAnimationFrame to batch updates in Chrome 35
In Chrome 31, setImmediate was yielding better behavior. But now Chrome
35 seems to behave more smoothly when we use requestAnimationFrame, and
the delay for keystrokes is non-existent.
2014-07-27 11:46:22 -06:00
Kevin Sawicki
d47348e8f9 Cache incompatible modules in local storage 2014-07-25 15:34:03 -07:00
Kevin Sawicki
56df7bdbe3 Add version to package 2014-07-25 15:23:36 -07:00
Kevin Sawicki
1ea909d4db Check installed packages for working native modules
Test require each native module in each installed package to make sure
it can be required successfully in Atom.
2014-07-25 15:19:16 -07:00
Nathan Sobo
7515fd94ba Merge branch 'master' into chrome35
Conflicts:
	package.json
2014-07-24 17:40:37 -07:00
Nathan Sobo
7738eeeacc Give the line-numbers div an opaque background for better GPU perf
We sample both the background color of the editor and the gutter. If the
gutter has an actual background color, we use it. Otherwise we fall back
to the same background as the editor.
2014-07-24 17:23:04 -07:00
Nathan Sobo
c6116468e4 Apply background color of root editor node to lines as an inline style
This ensures lines have an opaque background that matches whatever the
editor is styled as, but avoids the need to apply the .editor-colors
class to the .lines div. That approach fell down when people were
setting the background color via means other than .editor-colors, such
as styling mini editors via the .editor.mini selector in the settings
view.
2014-07-24 16:54:01 -07:00
Nathan Sobo
2a2d0b60f7 💄 2014-07-24 16:41:25 -07:00
Cheng Zhao
dcbf730129 Merge branch 'master' into chrome35
Conflicts:
	apm/package.json
	package.json
2014-07-24 17:17:35 +08:00
Ben Ogle
00275d95ec Merge pull request #3044 from atom/bo-h-scrollbar
Horizontal scrollbar no longer covers the gutter
2014-07-23 16:35:02 -07:00
Ben Ogle
242df788e6 Remove unnecessary scrollbar specs 2014-07-23 16:25:24 -07:00
Ben Ogle
3295b9b0dd Romove runSetImmediateCallbacks() in many cases
This is because of the removal of the gutter measurement. When there 
was measurement, every load of the editor would measure and request at 
least one render based on the reset of the gutter width. These 
specs don’t need to call runSetImmediateCallbacks() as they either 
don’t do anything to cause a render or they render immediately
(in the case of updated options).

In some cases, we need to make sure nothing happened, so I added a
hasSetImmediateCallbacks() function, which is used in specs where 
nothing should have happened.
2014-07-23 16:25:10 -07:00
Kevin Sawicki
adaee84933 Remove unused fixtures 2014-07-23 10:11:02 -07:00
Kevin Sawicki
84ff28ee69 Remove unused package fixtures 2014-07-23 10:11:01 -07:00
Kevin Sawicki
cfb1501720 Remove unused replication fixture 2014-07-23 10:11:01 -07:00
Ben Ogle
ffb041a160 Only render an nbsp on empty lines when no eol character defined
Fixes #3053
2014-07-23 09:30:52 -07:00
Ben Ogle
361f8ec770 Add specs for toggling the gutter when the editor is hidden 2014-07-22 18:26:58 -07:00
Ben Ogle
48a5123202 💄 Move logic into measureGutterIfNeeded 2014-07-22 18:26:58 -07:00
Ben Ogle
0f1d155685 Move gutterWidth into state; add specs for scrollbar position 2014-07-22 18:26:58 -07:00
Kevin Sawicki
5f7f5b5367 Merge branch 'master' into chrome35 2014-07-22 17:56:24 -07:00
Kevin Sawicki
bc4173f856 Remove logging of screen lines in spec 2014-07-22 14:51:13 -07:00
probablycorey
a3f046b948 Fix getVersion spec 2014-07-22 14:10:29 -07:00
Ben Ogle
17364cd528 Take the scrollbar width into account in specs 2014-07-22 11:54:26 -07:00
Nathan Sobo
5871bee791 Make spec assertions insensitive to scrollbars on Windows 2014-07-22 10:16:43 -07:00
Nathan Sobo
43c9e21f1d Make setEditorHeightInLines/WidthInChars spec helpers work with React
Fixes #3019
2014-07-21 15:04:44 -07:00
Nathan Sobo
ca1220a682 Delay initial measurement until the editor becomes visible
Previously, these measurements were always performed when the editor
component was mounted. This didn't work in situations where the
component was mounted in a non-visible state. This commit includes a
visibility check in the resize polling we were already doing, kicking
off the measurement process as soon as the editor is visible.
2014-07-21 13:40:10 -07:00
Nathan Sobo
0346e5809a Only prevent default on mousewheel events if editor actually scrolls
This prevents mini editors from capturing scroll events.
2014-07-21 10:43:31 -07:00
Nathan Sobo
99704517bb Remove animation frame batching of mousewheel events
This doesn't seem to adversely affect the scroll experience, and it's
much simpler. I want to avoid preventing the default action of
mousewheel events if they don't actually lead to scrolling, and making
the behavior synchronous will make that a lot easier.
2014-07-21 10:43:31 -07:00
Nathan Sobo
783ef730e2 Rename EditorComponent::measureScrollView to ::measureHeightAndWidth
Since we also check if we're auto-height in this method, this name seems
like a better description of the objectives of this method.
2014-07-21 10:43:31 -07:00
Nathan Sobo
e81db5d706 Pull out EditorComponent::pollDOM method
This makes the actions that we perform in the poll loop explicit, and
will prevent the accumulation of polling-related behavior in the
::measureScrollView method.
2014-07-21 10:43:31 -07:00
Nathan Sobo
d0893ccdaf Add placeholderText to React editors 2014-07-21 10:43:31 -07:00
Nathan Sobo
a9c7842a50 Don't render line decorations on mini editors 2014-07-21 10:43:31 -07:00
Nathan Sobo
544c759fd1 Don't set an explicit line height on mini editors
This allows the line height to be styled via CSS. I would actually
like to allow all these properties to be assigned via CSS rather than
explicitly via the settings view, but that can be deferred until the
old editor is removed.
2014-07-21 10:43:31 -07:00
Nathan Sobo
759dbc061d Don't render invisible characters in React mini editors 2014-07-21 10:43:31 -07:00
Nathan Sobo
56c9f75e8c Add the 'mini' class to the React wrapper view for mini editors 2014-07-21 10:43:30 -07:00
Nathan Sobo
635f288050 Explicitly assign height of editor-contents when height is auto 2014-07-21 10:43:30 -07:00