DavidGriffith / frotz

Infocom-style interactive fiction player for Unix and DOS (moved to https://gitlab.com/DavidGriffith/frotz)
GNU General Public License v2.0
209 stars 64 forks source link

Clear line #61

Closed escondida closed 6 years ago

escondida commented 6 years ago

Anywhere ^C isn't being used to send SIGINT, it instead clears the current line, as requested. https://github.com/DavidGriffith/frotz/issues/37

Patch 2 adds another standard UNIX command-line key, ^U, which traditionally clears from the character before point to beginning of line. Previously, frotz cleared the whole line with ^U.

At some point, I'd like to break some of these code blocks out into proper functions (e.g., have a delete_backwards(oldpos, newpos) function, which would cover a lot of spots in that big ol' case statement...

Also, I didn't mess with the indentation in the file, which is a mix of spaces and tabs.

Also also, in src/common/frotz.h, I kept with the convention of defining a hex value for the new bit. Out of curiosity, though, is there a reason that we care about most of those arbitrary values instead of just using an enum?

DavidGriffith commented 6 years ago

Those values are not arbitrary. They're from ZSCII, which is sort of an overlay of ASCII. See here: http://inform-fiction.org/zmachine/standards/z1point0/sect03.html. Comparisons and arithmetic are done on these values. Some values carry over from ASCII. Some are specific to the Z-machine spec. Some are implementation-defined. Fortunately, you picked the right value for this new one by placing it right after ZC_WORD_RIGHT and ZC_WORD_LEFT

DavidGriffith commented 6 years ago

I don't know why os_init_screen() calls cbreak() right after starting up curses, yet is commented as it it was calling raw(). Once I fixed that, ^C aborts the line being typed. I'm also adding ^Q to replace the functionality of ^C.

escondida commented 6 years ago

re: ZSCII, that's pretty neat! I should probably assign a different value for DEL_TO_BOL at some point, then, since I just made it up. Thanks!

DavidGriffith commented 6 years ago

Based on my understanding of ZSCII, you chose the right value. It's one of those implementation-defined values and you put it in a group set aside for that.