Follow

I've been scratching my head about how to handle the clipboard in Uxn's text editor a lot, and since there's only 64k of memory, and that the body of the text and the text-editor program share that same space, I couldn't really allow for large clipboards..

So, I figured that I could create an external file and save the clipboard in there, seems to be working well. Interesting challenge nonetheless.

· · Web · 4 · 3 · 15

@neauoire You've just made it super easy to run a script in Linux to write .clip and to use it in left straight away.

Scripters can select a bunch of text in a web page, press a hotkey to run "xsel -o > .clip" and bam, you can paste it already.

I'm sure people will think of great uses for the other direction - copying stuff out of left and integrating it with other Linux tools.

~ This is amazing!! ~

@alderwick yeah! it's also a great way to bring data directly into uxn from the host OS withing having to implement a dedicated Clipboard device(which I considered)

@neauoire Fun fact: the Commodore-Amiga and GEM operating systems both do exactly this, even despite having access to potentially megabytes or gigabytes of memory. The Amiga has 10 clipboard "units" (similar to Vim "registers").

@neauoire how are your eyes faring with the background color? not very ergonomic :)

@caffo I see yellow/orange for a few seconds when I look away XD

@neauoire haha I have very sensible eyes would be hard on me :)

@neauoire i have very specific ideas about how clipboards should work if you’re interested. not original ideas mind you, but informed by reading ux books and what not. but I’m not sure how stripped down and simplistic you’re intending to keep this, I don’t want to infodump on you unsolicited

@neauoire then I would just highly reccomend a mime Content-Type header

@zens I don't have space for that, just a header for a text file will be about 20-30 ish bytes, that leave 0 bytes for the actual implementation/parsing. Not a solution for me atm.

@neauoire hmm, then I’ll just have to build my own competing project. look forward to that spring 2030

@neauoire it’s going to just be text/plain for now, but it may spare you headaches in the future

@zens one option I considered was writing a short with the length of the clip at the beginning of the file, but that was a pain if you just wanted to import something into left with xclip.

@neauoire ah somethint like a fourcc would make sense if you’re that space limited

@zens What I ended up doing has been working quite well, I'll see, maybe I can improve upon this the more I use it.

I shove everything after the cursor at the end of the 64kb of memory, use that distance to caulculate the largest possible clip size, load that many bytes, and then move everything back with the clip offset.

git.sr.ht/~rabbits/left/tree/m

@neauoire i don’t want to just backseat drive without selling the benefits. i’m thinking about how a clipboard works between apps. if you’ve got nasu sharing a .clip file for e.g. you want a type marker so it can accept its own clips without accidentally pasting garbage- but also be able to paste chr data in your text editor source code

@zens in uxn everything is bytes, it wouldn't really make a difference if you paste text into noodle, it would draw little glitch pixels, or pixelart into left. There's no other type of data than bytes, the program sort of figure out how to use that data.

@zens it's satisfying, when a program will deal with multiple types of data, you can tell me i-told-you-so

@neauoire it’s not an I’m right you’re wrong sorta thing. you’ve got a vision, and a hard cap on complexity- i just don’t know where you exactly intend to draw that line- at mac classic or c64- or somewhere between

@zens the hardware is more like a c64 than a macintosh, and the space is basically half of a NES.

@neauoire it has made me imagine something similar but is, conceptually, out of scope for UXN, fundamentally, but i’m really personally excited about the notion of something which is fundamentally similar to classic mac os, but each windowd app runs as a rom on a VM with a frozen or at least radically backwards compatible platform api.

@neauoire like I keep longing to just switch to classic mac os for my daily driver, except that, as I am sure you’re aware, there’s certain practical issues that make this idea unrealistic

@zens I've done that for a bit, at least was doing most things in minivmac. It's fun, I recommend it, especially if you're interested in learning pascal, and/or drawing 1-bit pixel pictures.

@neauoire that’s how/when we first started following each other

@zens yeah! it's great :) It inspired me a log working in that ecosystem to build what I'm doing now. Lots of simple clever things that haven't really been revisited since.

@neauoire the clipboard stuff from earlier was from reading about the original macintosh engineers recalling that they couldn’t get the pasteboard to work well at all until they settled on a set of standard types that all the different applications agreed on.

but then, the thing they were going for was understandable to ordinary people who would be surprised by garbage pasting in. UXN does have an audience where that’s a feature not a bug.

Show newer
Sign in to participate in the conversation
Merveilles

Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.