I've had this problem for a few months now, and I can't figure out what's causing it. I'm using v23 on Linux.
Take this code as an example:
if (fwimage) {
} else {
len = ALIGN(fw->len, PAGE_SIZE);
fw->img = vmalloc(len);
if (!fw->img) {
printk(KERN_ERR "failed to vmalloc\n");
return -EINVAL;
}
memcpy(fw->img, src, fw->len);
}
I want to copy/paste the else-block into underneath the if-statement. So I select lines 3-11, put the cursor on line 2, and hit paste. This is what I get:
if (fwimage) {
len = ALIGN(fw->len, PAGE_SIZE);
fw->img = vmalloc(len);
if (!fw->img) {
printk(KERN_ERR "failed to vmalloc\n");
return -EINVAL;
}
memcpy(fw->img, src, fw->len);
} else {
len = ALIGN(fw->len, PAGE_SIZE);
fw->img = vmalloc(len);
if (!fw->img) {
printk(KERN_ERR "failed to vmalloc\n");
return -EINVAL;
}
memcpy(fw->img, src, fw->len);
}
Why is my code indented so much? Even weirder, is if I press Ctrl-Z now, it's fixed:
if (fwimage) {
len = ALIGN(fw->len, PAGE_SIZE);
fw->img = vmalloc(len);
if (!fw->img) {
printk(KERN_ERR "failed to vmalloc\n");
return -EINVAL;
}
memcpy(fw->img, src, fw->len);
} else {
len = ALIGN(fw->len, PAGE_SIZE);
fw->img = vmalloc(len);
if (!fw->img) {
printk(KERN_ERR "failed to vmalloc\n");
return -EINVAL;
}
memcpy(fw->img, src, fw->len);
}
How do I fix this?