Comments (8)
Hey, I am so sorry for the long delay in replying. I missed the notification and just saw it now! Especially, I really appreciate your quick example to repro.
For now, to avoid using a sleep, I would recommend solving this using runUntilSignal
:
session {
section {
textLine("Do something...")
}.runUntilSignal {
aside { textLine(" - a") }
aside { textLine(" - b") }
aside { textLine(" - b") }
aside { textLine(" - f") }
signal()
}
}
Note that you're running into a threading / race issue. When I ran this on my machine, one or two of the asides would actually print.
Beyond that, I will investiagate. I suspect what should happen is the run block shouldn't consider itself done as long as there are any remaining aside
blocks queued up for rendering. It's been a while since I looked at this code though and it might be a hairy, subtle interaction...
from kotter.
OK, looked a little more. What's happening is that a section is responsible for processing any aside blocks enqueued by the run
method.
But your section is ending so fast, it shuts down and then the run
block continues to add more aside
blocks. (section
and run
are two different threads working at the same time)
I'm experimenting to see if it's trivial enough to detect, when the run
method finishes, if one or more asides are still left, at which point, we kick off one more render request for the section (which should print out those remaining asides).
But so far the code is fighting me a bit (because debugging subtle threading issues is hard)...
from kotter.
Thanks for looking into it and providing me with a solution.
from kotter.
You're welcome. BTW I'm planning on looking at this again today.
After getting stuck last time, I decided to detour a little. I ended up finally starting to write unit tests (something I've been meaning to do for Kotter a long time -- I always wanted good code coverage to be a requirement to tag this library as v1.0).
What pushed me over the edge was the motivation to come back to this very bug. I'm hoping I can write a test that I can quickly run hundreds/thousands of times, to make sure things are working as expected.
from kotter.
OK, got it. It wasn't really that hard to fix once I got familiar with the code again. This was a great bug -- thanks for reporting!
I also added a unit test for this issue, and ran it a lot. It seems to be a solid fix.
This will be fixed whenever 0.9.10 (or later) goes out. The signal
fix above is harmless to keep at that point, but you won't need it anymore.
from kotter.
Ok. As mentioned on the other issue I will give it a try. Thanks for investing your time helping me out with that.
from kotter.
from kotter.
Just wanted to let you know: I've upgraded to 1.0.0-rc1 and things work like a charm :-)
from kotter.
Related Issues (20)
- Higher level API for building console applications HOT 1
- Section created as extension function does not update when livevar changes HOT 1
- can't write to last row of terminal HOT 1
- onKeyPressed doesn't listen for modified (e.g. ctrl-u, alt-a, etc.) characters HOT 1
- Windows Virtual Terminal Incorrectly Sizes Border HOT 7
- Request for Information on Sidebar's creation Using Off-Screen Api. HOT 3
- Add support for row-span / col-span in grid HOT 1
- Opening two session after another results in undefined behaviour of user input HOT 9
- Testing of extension methods HOT 25
- terminal.assertMatches not behaving as expected when testing input HOT 1
- Larger tests become flaky HOT 5
- Strange behaviour with key presses after using onKeyPressed or runUntilKeyPressed HOT 1
- Can't use Kotter without virtual terminal HOT 18
- Kotter is missing my native target
- Windows flickers if the content being redrawn is larger than the entire screen HOT 2
- K/N repaints duplicate lines if any particular line is too long horizontally HOT 2
- Add a test for Terminal#width HOT 1
- Windows + Kotlin/Native: Repaint issues reported (on legacy OS versions?) HOT 2
- K/N: Arithmetic Exception HOT 13
- Allow configuring fonts if possible
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 kotter.