summaryrefslogtreecommitdiffstats
path: root/selector.go
diff options
context:
space:
mode:
Diffstat (limited to 'selector.go')
-rw-r--r--selector.go8
1 files changed, 4 insertions, 4 deletions
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))
}
}