Live data from Hacker News

Show HN: Primrose – a text editor that runs in a WebGL texture

primroseeditor.com

71–80 of 105 posts

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#71
post #44

Just a warning, if you try this while using Safari it might crash and close all of your tabs somehow. And it might make it so that you can't reopen those tabs despite the fact that you have tabs set to be restored each session. And you may in fact experience the acute pain of losing a year's worth of painstakingly accumulated tabs. Not that this has happened to me.

> a year's worth of painstakingly accumulated tabs.

You cannot be serious about this. This is like writing a thesis and just never closing office and never saving. A year?

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#72
post #44

Just a warning, if you try this while using Safari it might crash and close all of your tabs somehow. And it might make it so that you can't reopen those tabs despite the fact that you have tabs set to be restored each session. And you may in fact experience the acute pain of losing a year's worth of painstakingly accumulated tabs. Not that this has happened to me.

Safari has this feature called Reading List, you should look into it.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#73
Looking at this 'virtual' text editor the text looks pretty smooth, until you get really close. Would it be possible to import typefaces as paths, and antialias them?

How do native apps do this, while also using hardware acceleration? Also, native apps can access sub-pixels for antialiasing, which I don't think is possible in a WebGL context.

I've seen OpenGL GUIs before, but I wonder what limits them compared to native apps, particularly when it comes to text and sub-pixel antialiasing.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#74

This is really cool, and it's the direction my project (with a large scope) will eventually go in. I already have a text editing component and highlighting working using OpenGL, but it needs updating to not use immediate mode so it can run in WebGL too.

Would love to hear more about your project.

Thanks. You can see it at https://github.com/shurcooL/Conception-go#screenshot, but it's less than 10% finished at this point. Everything you see is rendered in OpenGL. The text editing component has syntax and diff highlighting support.

It's written in Go, but I'm planning to have it running in the browser by compiling Go to JS and using OpenGL bindings with two backends: WebGL and OpenGL.

In terms of usability, it's nothing more than a complicated tech demo atm; I need to figure out its future direction.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#75

Earlier quoted context omitted.

Holy crap, great idea! Imagine if adding a "monitor" (virtually speaking, of course) to your setup was no more difficult than splitting a Vim window... that would be pretty rad. An Oculus Rift is much less expensive than your typical multi-monitor setup too, FWIW.

Actually, I'm hoping to be able to experiment with code layout ideas that do not strictly adhere to a window. 2D elements tend to not map well to 3D spaces. One of the problems with the text-in-a-texture method that I've done here is that there is no relief of depth to the text, and relief is actually an important part of how we make sense out of objects in 3D space. It's fine on a 2D screen because the context is so…

> Like, why do we still use plain text in flat files for source code

Text transports with full fidelity between print and screen, and between pretty much any system.

Anything beyond text becomes a) harder to communicate (e.g. consider how many people would struggle with even reading out loud maths formulas with symbols they are unfamiliar with; now extend that to trying to talk about representations that have extra spatial information), b) requires extra tooling for far more varied environments than you ever thought people actually code in (e.g. I have an idea; I want to write down code in my phones note-taking app)

Serializing it for IO is trivial. Representing it in a way that allows us to handle the two problems above in a way that makes it seem superior to text in enough cases is a very, very hard problem.

It's definitively intersting, though.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#78

Earlier quoted context omitted.

Holy crap, great idea! Imagine if adding a "monitor" (virtually speaking, of course) to your setup was no more difficult than splitting a Vim window... that would be pretty rad. An Oculus Rift is much less expensive than your typical multi-monitor setup too, FWIW.

Actually, I'm hoping to be able to experiment with code layout ideas that do not strictly adhere to a window. 2D elements tend to not map well to 3D spaces. One of the problems with the text-in-a-texture method that I've done here is that there is no relief of depth to the text, and relief is actually an important part of how we make sense out of objects in 3D space. It's fine on a 2D screen because the context is so…

I believe the reason is that graphical (2d) notations are harder to communicate and therefore not standardized. If they are standardized, they are usually very application specific and not really general enough. For example lambda calculus has a nice graphical representation as string diagrams, since it corresponds to calculations in a cartesian closed category. Typed lambda calculus has a similar representation, but with multicolored strings.

Pretty much any problem easily modeled as data flow has a nice a nice representation in an appropriate (traced, braided) monoidal category, examples would be electrical circuits, chemical reaction networks (simple atmosphere models, so called "Box models" are an example), hardware control software (LabVIEW), general ODE/Statemachine simulation (SIMULINK), "business processes" (forgot the name of the vendor), not to mention the various video/audio/shader programming environments.

Probably the intersection between the people capable of building a "generic" programming language for graphical programming and people who know enough category theory to inform the design is zero, even though software that solves subproblems of this kind is very successful. Ultimately you really want at least a 3d graphical language, because you want to express relations between 2d processes (for example the equation a+b = b+a, should be really understood as such a 3d process). Coincidentally relations between functions is something even programming languages like Haskell fail to address, it has type classes, but no way of specifying the equations that are required to hold.

The only language I'm aware of that does that is Magma, which unsurprisingly is based on Operads (essentially multicolored monoidal category with a fixed set of monoidal functors and natural transformations) and was designed by mathematicians and to a lesser extend Mathematica and Prolog.

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#79

So here's why this is particularly awesome in my head. I am a digital nomad, and basically travel with a backpack's worth of stuff, developing off my 13"MBA. The thing I miss the most about my old office is having a nice monitor. The thing I miss most about having a home is my 3-monitor desktop setup. Both things I had to give up because they don't fit in my backpack and because I can't easily procure them wherever I…

What stops you from having multiple windows on your desktop? Oculus sucks at displaying text - it's low resolution (half of 1080p), it has crazy chromatic abberations, and you have to transform "spherize" your image to correct for the lens distortion, further reducting the resolution. Oculus is not light - it's pretty annoying to wear it for longer than 20-30 minutes.

Nothing stops me from having multiple windows on my 13" desktop. But it's clunky to bounce between, and makes me lose context too easily ctrl/alt+shift/+tab/~/1/2/3-ing through my browser or text editor or output window. With a multi-display, I can just turn my face over or glance and look at what I need and be back in context right away. I mean, I hope I don't have to explain why multiple monitors are nice (for most people).

The same is conceivable with a VR solution. That makes it awesome.

As for the problems you mention, all extremely solvable. I'm sure you were alive when people were editing text on lower resolution displays. Lens technology for dealing with a great extent CA exists, it just needs to be tuned for VR settings. I could lie down and use it. Lighter materials could be used in future versions. It could be made disassemblable for easier packing/storage.

I have faith in our current generation of technologists to make these things and more happen before my development career sunsets :)

Re: Show HN: Primrose – a text editor that runs in a WebGL texture

#80
post #76

Sadly no umlauts, but the other alphanumeric keys are mapped correctly. Any chance for non-English keyboard support?

Which keyboard are you using? It's impossible to accurately detect keyboard layout in javascript, but I do provide a option to select keyboards. Unfortunately, the only ones I've had time to implement so far are US QWERTY, UK Extended QWERTY, FR AZERTY, and DEU QWERTZ.

There is a small bug that I haven't fixed yet that requires you to look away from the editor to make the drop down lists on the instructions page work.

As for other languages, I have a tool at https://primroseeditor.com/keyboard_test.html that can put together the code pages that I use for this. It supports dead keys for typing umlauts, but it can be a little fiddly to use. I've been using the Windows on screen keyboard to make them, so I don't know how well it maps to reality.

Unless you mean using alt codes to your Unicode characters directly, no, don't have that feature yet. To the list!

Post reply on HN