From f8c2e25b4ab337789a2e468a8f0aadb0c7fda42f Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sun, 9 May 2021 12:23:39 -0400 Subject: Replace call to memcpy, with call to memcpy_dir. This fixes a bug where when shifting the line left, it would overwrite everything after the cursor with the character at the cursor's position. The reason this was happening is because memcpy copies from start to end, and because the destination is more than one byte ahead of the source, it overwrites the next length source bytes, which will repeat until it's copied n bytes. --- programs/sub-suite/subeditor.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/sub-suite/subeditor.s b/programs/sub-suite/subeditor.s index 8337f51..1525fa8 100644 --- a/programs/sub-suite/subeditor.s +++ b/programs/sub-suite/subeditor.s @@ -898,7 +898,7 @@ shftln: lea d, (x+a) ; Get the address of the string pointer, at the cursor position, plus the offset. mov f, b ; Get the old end position. sub f, y ; Subtract the old end position, by the cursor position. - jsr memcpy ; Copy the string from the cursor, to the cursor plus the offset. + jsr memcpy_dir ; Copy the string from the cursor, to the cursor plus the offset. @clear: tya ; Get the cursor position. and c, c ; Is the left flag set? -- cgit v1.2.3-13-gbd6f