mirror of
https://github.com/atom/atom.git
synced 2026-01-27 15:58:00 -05:00
implement indexOfPane in RootView to get array index
We need something like this because jquery's el.index() doesn't work when multiple panes are spread out among different rows and columns.
This commit is contained in:
@@ -277,3 +277,11 @@ class RootView extends View
|
||||
eachBuffer: (callback) ->
|
||||
callback(buffer) for buffer in @project.getBuffers()
|
||||
@project.on 'buffer-created', (buffer) -> callback(buffer)
|
||||
|
||||
indexOfPane: (pane) ->
|
||||
index = -1
|
||||
for p, idx in @panes.find('.pane')
|
||||
if pane.is(p)
|
||||
index = idx
|
||||
break
|
||||
index
|
||||
|
||||
Reference in New Issue
Block a user