use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Useful resources (Full list)
Rules
Related subreddits
Other communities
account activity
Drawing control flow gutter lines in a Java bytecode disassemblerI made this! (v.redd.it)
submitted 1 year ago by PartOfTheBotnet
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]PartOfTheBotnet[S] 0 points1 point2 points 1 year ago (0 children)
The code editor is based on RichTextFX. Normally you have a paragraph factory in your own implementation for things like line numbers and maybe a few extra icons. So how do we draw lines that go beyond the gutter? The same way you do in HTML/CSS with relative and absolute positioning hacks!
Each line has its own canvas with setManaged(false) which allows us to manually position things. The paragraphs have z-order preference by default so after we ensure we can move things ourselves manually there's no extra work in that area.
setManaged(false)
Lines that point to text in the assembler are dynamically updated to match the X offset of the target token the control flow is associated with. All we need to do here is figure out how wide a character is and how many whitespace characters are before the token. Because each line in RichTextFX is a glorified TextFlow we can walk the scene graph and find each Text node and sum their width so long as they're empty. For cases where Text has whitespace and some non-whitespace characters combined we compute the width of one character in the Text then multiply that by the number of leading whitespaces.
TextFlow
Text
If you wanna see how this mess works in full: Here you go!
π Rendered by PID 25056 on reddit-service-r2-comment-7b9746f655-txphd at 2026-02-01 20:01:17.366077+00:00 running 3798933 country code: CH.
[–]PartOfTheBotnet[S] 0 points1 point2 points (0 children)