Tuesday | 30 APR 2024
[ previous ]
[ next ]

EVA - Multiline Delete

Title:
Date: 2024-01-09
Tags:  eva, BASIC

Fuck me. The in my multiline delete was the same one in my insert command. Typing o in visual mode results in a new line being inserted. I had a bug where on a multiline line the o didn't work right. [EVA] was simply inserting a line assuming that every line really was just a line.

It was only afterwards that I added in logic so that when inserting a line, I check to see if this is a multiline, if it is then I insert taking that into consideration.

This was something I had fixed awhile ago but I never put together that every function that works on a line will now need to work for multiline lines. Specifically in this case the dd option.

I haven't checked all the commands but the dd needs to be fixed. The fix took a hot minute because I wasn't super familiar with the code anymore and so I had to study it a bit to get going. Luckily because I did write the thing, I had a good idea of what the solution should be. I went down the wrong path and was adding too many lines. I scrapped that idea and re-did it the current way which I think is actually much better.

      LOCATE(REAL.LINE.NUMBER,LINE.NUMBERS;LINE.START.POS) ELSE LINE.START.POS = 1
      Y.POS = Y.POS - (CURRENT.LINE - LINE.START.POS)
      CURRENT.LINE = LINE.START.POS
*

This chunk of code finds where the line really starts and backs up the y position to the starting spot and sets the current line to the start position.

The trick is that instead of trying to do a delete in the middle, I find out if it is in the middle of a multiline, and if it is, it will reset the cursor to the start of the multiline.

This way the rest of the logic stays the same and a multiline delete is handled as normal.

This was only a problem at the bottom of a page. I should have noticed it earlier as deleting a paragraph would result in the cursor position not moving correctly. However in the middle of a page, it's something that I missed as the cursor being in the wrong place isn't as bad as getting into an infinite loop.

With that, the major bug in EVA is ironed out and I think this is the only bug that resulted in me losing data. I ran into this bug where I accidently exited the debugger instead of fixing it in the debugger and so lost data. Otherwise I was able to fix the issue in the debugger by setting the DONE variable manually.

I'm pretty happy that this bug has finally been sorted out. EVA for all intents and purposes is now done! (Though we'll see if it stays that way, I could have introduced a different bug now.)

Author's Note
13JAN2024
This fixed the multiline bug but there is still a bug specific to backspace that has been biting my every now and then. I need to spend some time finding this specific bug,.

Incoming Links

  1. [ EVA - Fixing Backspace ]
  2. [ Ideas in 2024 ]