I'm working on a text editor and a TUI library at the same time. As you can see in the gif, if I move the cursor up and down, it's hitting a certain point and moving on a diagonal. I've been chasing this bug for a few weeks and I need a second pair of eyes to work out what the problem is, because I'm out of ideas.
I believe the problem may come down to redrawing the screen on each cursor press. When I press the down key (j), this code is triggered. This moves the cursor down and redraws. The logging for these lines look like this:
[INFO] Action called: MoveCursorDown
[INFO] Pos(6, 6)
[INFO] Pos(6, 6)
[INFO] Action called: MoveCursorDown
[INFO] Pos(7, 6)
[INFO] Pos(7, 7)
[INFO] Action called: MoveCursorDown
[INFO] Pos(8, 7)
[INFO] Pos(8, 8)
As you can see, it moves down on the move_cur_down() call (line 45) and then moves right on the redraw for some reason. Through a chain of functions, the redraw_pane() calls this draw function in the aformentioned library, and part of me is suspicious about the move_cur_out_of_blacklist() call at the end, although that function looks perfectly fine? The while loop shouldn't be triggering, and doesn't seem to be from what testing I've done.
The reason the number 6 stands out, btw, is this line that I'm using to generate the line numbers - the file I'm opening is 100~ lines long, plus 1 trailing box-drawing character, plus the first column should always be empty, so the 6th character in the column is where the file's text is first being drawn, and the cursor shouldn't be able to go into the box-drawing char.
I've been honestly tearing my hair out about all of this for almost two weeks, I'm hoping someone else can spot something I've missed. Thank you