Skip to content

Commit

Permalink
[71_41] UI: Do not show subparagraph in the section context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
da-liii authored Aug 25, 2024
1 parent 72eff97 commit d41d863
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion TeXmacs/progs/text/text-menu.scm
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,12 @@
(define (get-verbatim-section-title s indent?)
`(verbatim ,(tm/section-get-title-string s indent?)))

(define (all-sections)
(list-filter (tree-search-sections (buffer-tree))
(lambda (x) (not (equal? (tree-label x) 'subparagraph)))))

(tm-menu (focus-section-menu)
(for (s (tree-search-sections (buffer-tree)))
(for (s (all-sections))
((eval (get-verbatim-section-title s #t))
(when (and (tree->path s) (section-context? s))
(tree-go-to s 0 :end)))))
Expand Down
7 changes: 4 additions & 3 deletions src/Data/Tree/tree_traverse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,10 @@ void
search_sections (array<tree>& a, tree t) {
if (is_atomic (t)) return;
else if (N (t) == 1 && section_tags->contains (L (t))) a << t;
else if (section_traverse_tags->contains (L (t)))
for (int i= 0; i < N (t); i++)
search_sections (a, t[i]);
else if (section_traverse_tags->contains (L (t))) {
for (tree subtree : t)
search_sections (a, subtree);
}
}

array<tree>
Expand Down

0 comments on commit d41d863

Please sign in to comment.