From cccc2fe128559c5edbf21e4da37e9d75a3429250 Mon Sep 17 00:00:00 2001 From: clsr Date: Mon, 4 Sep 2017 10:54:27 +0200 Subject: Update selectors to CNM 0.4 --- selector.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'selector.go') diff --git a/selector.go b/selector.go index 5259df2..ff1e7c1 100644 --- a/selector.go +++ b/selector.go @@ -128,7 +128,7 @@ func selectSearch(block Block, titles []string, any bool) ([]int, Block) { return []int{}, block } - if bl, ok := block.(*SectionBlock); ok { + if bl, ok := block.(*SectionBlock); ok && bl.Title() != "" { if len(titles) == 1 && bl.Title() == titles[0] { return []int{}, bl } @@ -162,7 +162,7 @@ func selectSectionIndex(block Block, secs []int) ([]int, Block) { if secs[0] < 1 { return nil, nil } - if cb, ok2 := c.(*SectionBlock); ok2 { + if cb, ok2 := c.(*SectionBlock); ok2 && cb.Title() != "" { secs[0]-- // starts with 1 for first section if secs[0] == 0 { if len(secs) == 1 { @@ -246,8 +246,8 @@ func duplicateBlock(block Block, deep, sections bool) Block { if cb != nil && deep { for _, ch := range block.(ContainerBlock).Children() { - _, isSection := ch.(*SectionBlock) - cb.AppendChild(duplicateBlock(ch, sections || !isSection, sections)) + sb, isSection := ch.(*SectionBlock) + cb.AppendChild(duplicateBlock(ch, sections || (!isSection || sb.Title() == ""), sections)) } } -- cgit