repl.it/@Kasran/colortest if anyone wants to inspect this code (do note that it emphatically doesn't work properly when you try to run it from repl.it, at least not for me)

i already know how to move the cursor around and clear the screen with escape sequences too. once i learn the ways of raw nonblocking I/O im gonna make so much barely functional textmode garbage

@typhlosion Noice! You know more than me then, I just know how to make pretty colors and clear to the end of the line. :3

@typhlosion It's fantastic! A veritable playground of text arrangement! :D

@typhlosion when you're working on unbuffered keyboard input, if you have any questions about termios(3) I might be able to help, please feel free to ask 😁

@typhlosion (looks like the main problem is repl.it chokes on non-ascii characters in program output? also their terminal doesnt support true color mode, so it's using the nearest color from what i assume is xterm's 256 color palette instead)

@typhlosion (terminal codes are hella cool though, its 2019 and i fucking love text based user interfaces)

@bossposs fuck yeah

like i said, once i master raw input im gonna make some horrible nonsense and no one can stop me

@typhlosion You're not a REAL terminal wizard until you do it in shell! :P

(just kidding of course, this is pretty sweet! 👍)

@IceWolf do you mean running it using sh, or writing a shell script to do it?

@typhlosion Shell script. How would running a C program in sh be any different than in bash? (:

@IceWolf i have no idea how ANSI escape sequences actually work, so if someone told me sh didn't properly support 24-bit color somehow, i wouldn't be surprised

@typhlosion Escape sequences are literally just strings of characters you print to stdout. It's the terminal that matters, you can do them from any language at all. :3

@typhlosion Basically all that's special about them is the terminal sees it, goes "oh, it's an escape sequence", and does things.

@IceWolf i kind of feel like you're talking down to me and i dont really appreciate it

@typhlosion Huh? Oh, that wasn't my intention at all! I'm so sorry. ):

@typhlosion Thanks for being so upfront about it and letting me know. I'll do my best to not do that in the future.

@IceWolf turns out you can just printf at the command line so this isn't as much of a flex as i thought it would be

@IceWolf y'know, a boast, a showoffy move. i thought it would make me feel more like a terminal wizard! but it's basically just a condensed, somewhat worse version of the C code haha

@typhlosion Ah! Haha, yeah, I was completely kidding on that. C is more impressive in the first place. Shell is handy, but it's...quick and dirty. (:

@IceWolf the piece de resistance of the internals is

calc() { awk "BEGIN{ print $* }"; }

which i legit have in my .bashrc file at work, it's super useful

@typhlosion Using awk as a calculator? Huh, neat! I just use my shell, $(( )) and I can do floating-point math. Also, zcalc is really handy for when I need something more interactive. (:

@typhlosion Isn't it great? :D

Keep in mind bash only supports integer math, though.

I actually used zsh to do integration approximation (Reimann sums) in Calculus II. :P

Show newer

@IceWolf i mean i know that much, but everything about computers is slightly more arcane than it needs to be, so i have learned to be suspicious always

Sign in to participate in the conversation
Awoo Space

Awoo.space is a Mastodon instance where members can rely on a team of moderators to help resolve conflict, and limits federation with other instances using a specific access list to minimize abuse.

While mature content is allowed here, we strongly believe in being able to choose to engage with content on your own terms, so please make sure to put mature and potentially sensitive content behind the CW feature with enough description that people know what it's about.

Before signing up, please read our community guidelines. While it's a very broad swath of topics it covers, please do your best! We believe that as long as you're putting forth genuine effort to limit harm you might cause – even if you haven't read the document – you'll be okay!