EditSession.selectMarker checks if the marker is valid

Also, it returns the selected range if it's valid, and otherwise
returns a falsy value. This has more utility than just true/false.
This commit is contained in:
Nathan Sobo
2013-04-29 10:22:07 -06:00
parent a028dff6e9
commit caf34d6a3a
2 changed files with 16 additions and 9 deletions

View File

@@ -1411,11 +1411,10 @@ class EditSession
@getLastSelection().expandOverWord()
selectMarker: (marker) ->
if bufferRange = marker.getBufferRange()
@setSelectedBufferRange(bufferRange)
true
else
false
if marker.isValid()
range = marker.getBufferRange()
@setSelectedBufferRange(range)
range
# Public: Given a buffer position, this finds all markers that contain the position.
#