I checked it and found that the error should be in this line
It does not detect the marks on both sides, but only detects the mark on the right (tail). If a mark appears on the right side of the selected text, it enters the deletion block
This means something** will become mething by pressing ctrl + b
Made a PR to fix it