My own Programming Editor
- 9 Devlogs
- 9 Total hours
You can write in BASIC language a simple code
You can write in BASIC language a simple code
Just when I thought everything was going according to plan my code wanted to prove me wrong 💀💀🤣🤣
There seems to be a massive bug when using Debug mode when you have scrolled a bit so scroll_offset != 0; then this bug occurs even though I thought I have implemented scroll offset in the start_debug_mode();.
Now the good news. I have fixed annoying bugs with the writing in the editor now you can’t skip after a \0 and can’t write mid editor which has broken everything previously.
Here is the screenshot of the debug scroll bug:
this took way too long 💀
I added debug mode - press F1 and the interpreter steps through your program
line by line. current line gets a < marker, all assigned variables are
shown live on the right side.
Errors are Highlighted Red and the end is highlighted Green.
I am pretty proud of that
I also spent an embarrassing amount of time chasing a bug where deleting a
character would make the line number of the line below disappear. tried
everything like textbackground resets, gotoxy fixes, cursor position saving,
redraw order changes - none of it worked.
turns out I just forgot to reset debugmode back to 0 after leaving debug mode.
This simple Problem stole 1h of by life 💀
I have also updated the README with debug mode docs, config.txt explanation and swapped
the install section for a direct link to the releases page.
ran out of new features so I did what every developer does at this point - stared at the editor until things started bothering me 🤣.
I refined the design and made it more colorful. then I noticed that scrolling
was never truly implemented. scroll_offset existed, was passed around, just
never actually updated anywhere 💀
int scroll_offset = 0;
scrolling should work now. I sure hope so.
then I took a look at the menu and decided to rewrite it completely because I
didn’t like how you interacted with it. the new version has proper feedback
when saving or changing the filename and a quick confirmation if you really
want to quit or stay.
feel free to test it in the new pre-release:
github.com/MrLuki2727/OwnLanguage/releases/tag/v1.1
Previously the editor always opened Code.lu ( this was hardcodet with
#define FILENAME )
Now the last opened filename gets written to config.txt on save and is loaded
on startup. fgets pulls the name, strcspn strips the newline. (Revolutionary tech there 🔥🔥🔥)
After running a program or opening the menu the cursor was landing somewhere
random on screen. I fixed it by saving x and y with getxy() before switching modes,
and restoring it with gotoxy() .Then everithing is redrawn.
The cursor now comes back exactly where you left it. I thought this was implemented vom the start but it turns out it was not right 💀.
Added a proper README with a platform support table (Windows only) , step by step build instructions for CLion.
Syntax highlighting is here! Honestly thought this would take way longer than it did.
The approach is simple: walk through the string character by character, check
what type the next token is (keyword, variable, number, operator, bracket) and
set the color before printing. The actual characters are printed 1:1 so if there are 17 spaces there will be printed 17.
Color changes are handled by a prebuilt textColor(COLOUR); function that just
sets the console color before the next print. Clean and simple.
Known bugs I definitely know about and totally plan to fix (eventually):
– Can’t write mid-line because of a \0 at the start of the string 💀
– Pressing delete at the end of a line removes the entire line (is this a bug or a feature? I’m choosing to call it a feature for now)
Next up: fixing the actual bugs. Probably.
Added ELSE and WHILE - the language is getting dangerous 💀🤣
ELSE was actually pretty simple: after an IF, just check in the next line
see if it says “ELSE”, skip the keyword and execute whatever comes after.
Done. Took longer to think about than to code.
WHILE was a completely different. After a bit of thinking I came up that WHILE is basically just IF + GOTO
combined. If the condition is true, keep going. If false, i run through the program array for the matching ENDWHILE (counting WHILEs
so you it works with more WHILES. ENDWHILE does the reverse - searches
backwards for its WHILE and jumps back.
Next goal : Synax highlighting
I completely rebuilt the drawing system for the editor, making it efficient enough for my next goal: syntax highlighting. Now only the line where code was changed gets refreshed, instead of redrawing the entire screen every keystroke. The whole refreshing should be working right know haven’t noticed any bugs. (yet 🤣)
I started working on the editor yesterday. I was so focused on the code that I didn’t notice the whole logging system wasn’t working because I forgot to include the plugin. I just noticed and fixed the problem. Right now, I am mostly working on syntax highlighting (I don’t really know how to do that yet 💀), but in the last 30 minutes, I finished a basic menu to save, quit, and edit the filename.
The editor isn’t really based on the BASIC language. Instead, it’s a mix of commands from different languages that I found cool, which allowed me to create my own custom language mix. I have already finished a basic visual style for the editor (unfortunately, it still has some bugs 😂) as well as a simple syntax checker that somehow works. I also wrote a simple program with a print output, and everything seems to work perfectly.”