'o' and 'a' from Vim

This commit is contained in:
2025-10-15 18:05:44 +11:00
parent 0ff15b496c
commit b51bb8b8d2

View File

@@ -226,6 +226,24 @@ int main(int argc, char** argv) {
lines = undoHistory[undos].lines; lines = undoHistory[undos].lines;
pos = undoHistory[undos].pos; pos = undoHistory[undos].pos;
break; break;
case 'a':
currMode = mode::INSERT;
if (!(pos.x + 1 > lines[pos.y].size())) {
pos.x ++;
}
break;
case 'o':
currMode = mode::INSERT;
{
size_t line_idx = pos.y - 1;
if (line_idx < lines.size()) {
lines.insert(lines.begin() + line_idx + 1, "");
pos.y++;
pos.x = 0;
if (!fileChanged) fileChanged = true;
}
}
break;
case 'h': case 'h':
case KEY_LEFT: case KEY_LEFT:
if (pos.x > 0) { if (pos.x > 0) {