mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Stylize command panel preview
This commit is contained in:
@@ -18,7 +18,12 @@ class Operation
|
||||
|
||||
preview: ->
|
||||
range = @anchorRange.getBufferRange()
|
||||
@buffer.getTextInRange(range)
|
||||
line = @buffer.lineForRow(range.start.row)
|
||||
prefix = line[0...range.start.column]
|
||||
match = line[range.start.column...range.end.column]
|
||||
suffix = line[range.end.column..]
|
||||
|
||||
{prefix, suffix, match}
|
||||
|
||||
destroy: ->
|
||||
@buffer.release()
|
||||
|
||||
@@ -3,7 +3,13 @@
|
||||
module.exports =
|
||||
class PreviewItem extends View
|
||||
@content: (operation) ->
|
||||
{prefix, suffix, match} = operation.preview()
|
||||
|
||||
@li =>
|
||||
@span operation.getPath(), outlet: "path", class: "path"
|
||||
@span operation.preview(), outlet: "preview", class: "preview"
|
||||
@span outlet: "preview", class: "preview", =>
|
||||
@span prefix
|
||||
@span match, class: 'match'
|
||||
@span suffix
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user