Skip to content

Commit

Permalink
Fix selection of w/W vim motions (#1555)
Browse files Browse the repository at this point in the history
Fix yank word in normal mode
  • Loading branch information
Yaraslaut committed Jul 3, 2024
1 parent ddb1dfa commit ff7fc99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
<li>Fixes status line crush (#1511)</li>
<li>Fixes application window icon on (KDE) Wayland</li>
<li>Improves handling of constant bell sound spawning</li>
<li>Fixes yW (yank WORD) not working properly in normal mode (#1448)</li>
</ul>
</description>
</release>
Expand Down
5 changes: 4 additions & 1 deletion src/vtbackend/ViCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ void ViCommands::executeYank(ViMotion motion, unsigned count)
}
default: {
auto const [from, to] = translateToCellRange(motion, count);
executeYank(from, to);
// motion is inclusive but for yank we want to exclude the last cell which is the first cell of
// the next word
executeYank(from, { to.line, to.column - 1 });
}
break;
}
Expand Down Expand Up @@ -979,6 +981,7 @@ CellLocation ViCommands::translateToCellLocation(ViMotion motion, unsigned count
prev = current;
current.column++;
}

return current;
}
case ViMotion::BigWordEndForward: // E
Expand Down

0 comments on commit ff7fc99

Please sign in to comment.