Comments (25)
we need change InspectGenDecl func as:
for i, field := range st.Fields.List {
if field == nil {//---------------------------------------> add this
continue
}
// if we have no names, we are embed, so add to embeds and remove from fields
if len(field.Names) == 0 {
emblist.List = append(emblist.List, field)
st.Fields.List = slices.Delete(st.Fields.List, i+delOff, i+1+delOff) // we need to add delOff to correctly handle situations where we delete multiple times and our indices become inaccurate
delOff-- // we have deleted so we need to update offset
}
}
from core.
I can not reproduce this issue; are you doing anything other than just running go test
in gtigen
?
from core.
The reason that the test is failing is that you are running it outside of the normal location of the code, which means that it can not load the correct files for the test, and thus it panics. I do not know why GoLand decides to put everything in bizarre temporary locations, as that is the cause of both this issue and the Vulkan panic. This will work if you run the test in the normal way by just running go test
in gtigen
, so this is not an issue. We will not support running tests in the wrong location, and the test works perfectly with both the standard command line workflow and VS Code. You can probably configure GoLand to place executables and tests in the current directory. Adding a pointless nil check does not fix this problem; you are conflating not panicking and working: just because something doesn't panic doesn't mean that it works. Most of the nil panic issues are caused by other problems, and adding a simple nil check almost never fixes the actual problem.
from core.
Ok
from core.
from core.
I have a different take on this issue.
from core.
for i := 0; i < len(st.Fields.List); i++ {
field := st.Fields.List[i]
// if we have no names, we are embed, so add to embeds and remove from fields
if len(field.Names) == 0 {
emblist.List = append(emblist.List, field)
st.Fields.List = slices.Delete(st.Fields.List, i+delOff, i+1+delOff) // we need to add delOff to correctly handle situations where we delete multiple times and our indices become inaccurate
i++
delOff-- // we have deleted so we need to update offset
}
}
from core.
As for vulkan, as long as you've successfully mocked the various events inside the unit tests, I'll patiently debug it and see if I can find the cause of the actual panic. But between the invisibility of cgo code to debugging, I'm not sure, unless there's an alternative way to intercept the cgo execution flow
from core.
Please tell me whether the gtigen
test still panics when you run it in Git Bash with go test
.
from core.
from core.
Please send me a screenshot of you running go test
in gtigen
.
from core.
from core.
It is really weird that it panics on your computer but not mine. I will work on debugging this now.
from core.
You write the code you should be very clear about the logic of its implementation, slice 5 members, deleted a, the remaining 4, range to the fourth time, 4 is index, starting from 0, in fact, he is 5, but has been deleted, so the empty pointer panic
from core.
for i := 0; i < len(st.Fields.List); i++ { field := st.Fields.List[i] // if we have no names, we are embed, so add to embeds and remove from fields if len(field.Names) == 0 { emblist.List = append(emblist.List, field) st.Fields.List = slices.Delete(st.Fields.List, i+delOff, i+1+delOff) // we need to add delOff to correctly handle situations where we delete multiple times and our indices become inaccurate i++ delOff-- // we have deleted so we need to update offset } }
This fix perfectly matches the execution logic of your code
from core.
Sorry, I misunderstood the situation, and I will apply that fix now.
from core.
I would like to ask you a question, I'm trying to understand the execution of core by debugging, but I have not been able to find the place where the reflected structure is. For example:
func TestStructView(t *testing.T) {
b := gi.NewBody()
NewStructView(b).SetStruct(myStructValue)
b.AssertRender(t, "structview/basic")
}
As I understand it, SetStruct is supposed to perform reflection, i.e.: reflect the struct to the ki n-forked tree structure, then various traversals to add events, styles, etc. to send to vulkan, and finally vulkan hands it off to glfw to interact with the graphics card hardware. But I didn't find any code related to the reflection structure.
from core.
You are asking how the entire architecture of Cogent Core is structured, which is a hard question to easily answer. I will write architecture documentation that explains all of that soon, but until then, here is a simple answer: SetStruct
results in StructView.ConfigWidget
happening, in which the reflect.Value
of the struct is used to construct a widget structure with labels and values for the fields of the struct. The struct view and the widgets add events and styles functions to the widgets, which are then called in later event loop and style application passes. All of the content is later rendered to an image on the Scene
, which is then pushed to the screen with Vulkan.
from core.
Can you try my new fix for this issue?
from core.
Sorry I just fell asleep for a while and it's 2:30 a.m. Thank you for the explanation of the reflection part. Also, I'm a little curious if you won't panic on your computer before this fix? Didn't you test? What's even stranger is that I didn't panic on my computer after running the core command for so long, perhaps for only one reason: except for this unit test scenario, all the core commands executed did not trigger names==0 to delete the slice member. It's just that when I execute the unit test, it crashes. In addition to this, the core command also has a warning under the giv package and exits, indicating that the field name is the same, which I guess is roughly the stake: the two fields of the struct have the same name. It should mean something similar.
from core.
from core.
from core.
Hello, I'm going to write an interface for ollama, but I don't know how to insert text into the text editing widget continuously without clearing the previous insertion, because the AI chat scene is the uninterrupted output of text, if the one-time output feels like the chat delay on a low-configuration device, so we need to support the stream feature, one input, streaming output. Is there a way to do this in the text editing widget?
from core.
The response from the AI should not be in a text editor; it should be in a Label
. You can just call Label.SetTextUpdate
with the newly streamed text whenever you want to.
from core.
from core.
Related Issues (20)
- texteditor not getting scrollbars for Find, perhaps some other cases? HOT 1
- TreeView DND leaves items highlighted; NaN in TreeView HOT 2
- fileview not updating on rename
- Crash when getting monitors
- Use libmpv instead of libav for video HOT 4
- treeview not expanding to specified opendepth
- blur render in std box is not clearing properly, for transparent background case, i.e., with dialogs, menus etc. HOT 2
- file view chooser filenames not expanding to show full filename for long names
- dnd scrolling not working in filetree (code)
- Add back python (gopy) support (add corepy)
- texteditor/layout.go use hash codes to optimize render updates
- terminal emulator widget
- Increase test coverage
- Issue running the next command after terminating a command in cosh HOT 3
- Cosh sometimes hangs when terminating a command
- vulkansdk-macos-1.3.261.1.dmg left around on disk HOT 2
- crash log path should decode spaces ? HOT 3
- Crashlog should have OS version too ? HOT 6
- video demo needs libav HOT 1
- core example: basic: link error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.