DJMcMayhem / V

A golfing language inspired by everybody's favorite text editor, vim.
77 stars 9 forks source link

Duplicate operator is borked. #6

Closed DJMcMayhem closed 8 years ago

DJMcMayhem commented 8 years ago

For example, look at this program:

ysw|Äx

Explanation:

ysw|           "Surround this word in '|'
    Ä          "Duplicate this line
     x         "Delete a character

For some reason though, this deletes the character before duplicating the line. I'm guessing it's most likely a bug with the feedkeys function putting the paste command in the wrong place in the keypress queue. The same issue comes up if you put the duplicate command in a macro. For example, this program:

i¸ 1 X 8 + 1 = 98ñYp|Eäl^Xf+$äl

Clearly prints all the "ones" after the macro is done executing.

DJMcMayhem commented 8 years ago

So, I ended up replacing the duplicate "psuedo operator" with an actual vim-operator. It was a little bit hacky since I want to treat 3<dup>w differently than <dup>3w. The first will yank one word, and paste it 3 times. The second will yank 3 words and paste it 1 time. Anyway, this issue is fixed now.