|
|
|
@ -25,16 +25,51 @@ namespace groove { |
|
|
|
|
this->editor.clipboard = this->editor.buffer->at(this->editor.y); |
|
|
|
|
break; |
|
|
|
|
case 'x': |
|
|
|
|
this->editor.clipboard = this->editor.buffer->at(this->editor.y); |
|
|
|
|
this->editor.buffer->remove(this->editor.y); |
|
|
|
|
{ |
|
|
|
|
long y = this->editor.y; |
|
|
|
|
std::string line = this->editor.buffer->at(y); |
|
|
|
|
this->editor.history.push( |
|
|
|
|
HistoryNode([this, y, line](){ |
|
|
|
|
this->editor.buffer->insert(line, y); |
|
|
|
|
}, [this, y](){ |
|
|
|
|
this->editor.buffer->remove(y); |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
this->editor.clipboard = this->editor.buffer->at(y); |
|
|
|
|
this->editor.buffer->remove(y); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'v': |
|
|
|
|
this->editor.buffer->insert(this->editor.clipboard, this->editor.y); |
|
|
|
|
{ |
|
|
|
|
std::string clipboard = this->editor.clipboard; |
|
|
|
|
long y = this->editor.y; |
|
|
|
|
this->editor.history.push( |
|
|
|
|
HistoryNode([this, y](){ |
|
|
|
|
this->editor.buffer->remove(y); |
|
|
|
|
},[this, y, clipboard](){ |
|
|
|
|
this->editor.buffer->insert(clipboard, y); |
|
|
|
|
this->editor.y = y; |
|
|
|
|
this->editor.x = this->editor.buffer->at(y).size(); |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
this->editor.buffer->insert(clipboard, y); |
|
|
|
|
this->editor.y++; |
|
|
|
|
this->editor.x = this->editor.buffer->at(this->editor.y).size(); |
|
|
|
|
this->editor.x = this->editor.buffer->at(y).size(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'd': |
|
|
|
|
{ |
|
|
|
|
long y = this->editor.y; |
|
|
|
|
std::string line = this->editor.buffer->at(y); |
|
|
|
|
this->editor.history.push( |
|
|
|
|
HistoryNode([this, y, line](){ |
|
|
|
|
this->editor.buffer->insert(line, y); |
|
|
|
|
}, [this, y, line](){ |
|
|
|
|
this->editor.buffer->remove(y); |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
this->editor.buffer->remove(this->editor.y); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'l': |
|
|
|
|
switch (this->editor.lineMode) { |
|
|
|
@ -49,6 +84,11 @@ namespace groove { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'u': |
|
|
|
|
this->editor.history.undo(); |
|
|
|
|
break; |
|
|
|
|
case 'r': |
|
|
|
|
this->editor.history.redo(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|