I’ve found something that I really like about Go compared to TypeScript: you don’t need to import identifiers (e.g. functions) from other files if they’re all part of the some package.
I did a big refactor to split the 400-line behemoth main.go into a handful of smaller files. I was fully expecting to have to import each and every constant, type, and function between files. But I didn’t have to! Because every file is part of the main package, they all use the same namespace or something. I defined the statusMsg struct in update.go, but I can just instantiate a statusMsg literal in file.go without any imports or anything! This is a really cool language feature. 10/10.
Anyways, apart from the big refactor, I did the following:
- the cursor is now the actual terminal cursor rather than a fake drawn-on cursor.
- if you use left arrow at the start of a line, the cursor moves to the end of the line above.
- if you use right arrow at the end of a line, the cursor moves to the start of the line below.
- delete! It’s exactly like backspace but in the opposite direction.
- tab! As mentioned,
decioperates on a strict “1 character = 1 byte = 1 column’ basis because I don’t wanna deal with Unicode, so properly implementing tabs was out of the question. Instead, I just made the tab key instantly insert 4 spaces.
None of this stuff was on last devlog’s list of features to implement. I just kept noticing that these behaviors were missing while playtesting, so I implemented them. Next up is the aesthetic stuff like the status bar that I promised last devlog.
Comments 1
peak bro keep going!!
Sign in to join the conversation.