mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Support clicking line numbers in gutter
Clicking moves the cursor to the start of the row and shift-clicking selects to the start of the row
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
Range = require 'range'
|
||||
Point = require 'point'
|
||||
|
||||
module.exports =
|
||||
class Gutter extends View
|
||||
@@ -22,6 +23,14 @@ class Gutter extends View
|
||||
highlightLines = => @highlightLines()
|
||||
editor.on 'cursor-move', highlightLines
|
||||
editor.on 'selection-change', highlightLines
|
||||
@on 'click', '.line-number', (e) =>
|
||||
row = parseInt($(e.target).text()) - 1
|
||||
position = new Point(row, 0)
|
||||
if e.shiftKey
|
||||
@editor().selectToScreenPosition(position)
|
||||
else
|
||||
@editor().setCursorScreenPosition(position)
|
||||
|
||||
@calculateWidth()
|
||||
|
||||
editor: ->
|
||||
|
||||
Reference in New Issue
Block a user