wrap matches in their own list

This commit is contained in:
Justin Palmer
2013-02-13 10:38:00 -08:00
parent f536d21ca6
commit 112e389306

View File

@@ -40,14 +40,15 @@ class PreviewList extends ScrollView
@li class: classes.join(' '), =>
@span path
@span "(#{ops.length})", class: 'path-match-number'
for operation in ops
{prefix, suffix, match, range} = operation.preview()
@li 'data-index': operation.index, class: 'operation', =>
@span range.start.row + 1, class: 'line-number'
@span class: 'preview', =>
@span prefix
@span match, class: 'match'
@span suffix
@ul class: 'matches', =>
for operation in ops
{prefix, suffix, match, range} = operation.preview()
@li 'data-index': operation.index, class: 'operation', =>
@span range.start.row + 1, class: 'line-number'
@span class: 'preview', =>
@span prefix
@span match, class: 'match'
@span suffix
@setSelectedOperationIndex(0)
@show()
@@ -69,8 +70,8 @@ class PreviewList extends ScrollView
setSelectedOperationIndex: (index, scrollToOperation=true) ->
index = Math.max(0, index)
index = Math.min(@operations.length - 1, index)
@children(".selected").removeClass('selected')
element = @children("li.operation:eq(#{index})")
@find('li.selected').removeClass('selected')
element = @find("ul.matches li.operation:eq(#{index})")
element.addClass('selected')
if scrollToOperation