Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add menu:create_page(page_size, page_no) #293

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

shewer
Copy link
Contributor

@shewer shewer commented Dec 8, 2023

CandidateList menu:create_page(page_size, page_no)

local seg =  ctx.composition:back()
local cands = seg and seg.menu 
     and seg.menu:create_page(5,0)
cands = cands or {}
for _, cand in ipairs(cands) do print(cand.text) end

CandidateList menu:create_page(page_size, page_no) 
```lua
local seg =  ctx.composition:back()
local cands = seg and seg.menu 
     and seg.menu:create(5,0)
cands = cands or {}
for _, cand in ipairs(cands) do print(cand.text) end
```
src/types.cc Outdated
@@ -374,6 +374,13 @@ namespace MenuReg {
return New<T>();
}

CandidateList create_page(T& t, size_t page_size, size_t page_no) {
if (auto p = an<Page>( t.CreatePage(page_size, page_no)) ) {
return p->candidates;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

返回了一个局部 shared_ptr 的成员,可能要论证一下是否有内存方面的问题

改回原式  井  手動刪除 Paeg 記憶體
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants