|
|
@ -110,12 +110,22 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
void GetAnyKeyPress(olc::Key k)override{ |
|
|
|
void GetAnyKeyPress(olc::Key k)override{ |
|
|
|
lastBlinkTime=0.5f; |
|
|
|
lastBlinkTime=0.5f; |
|
|
|
|
|
|
|
if (k==DEL){ |
|
|
|
|
|
|
|
if (cursors[0].pos==document[cursors[0].line].size()){ |
|
|
|
|
|
|
|
if (cursors[0].line<document.size()-1){ |
|
|
|
|
|
|
|
document[cursors[0].line].append(document[cursors[0].line+1]); |
|
|
|
|
|
|
|
document.erase(document.begin()+cursors[0].line+1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
document[cursors[0].line].erase(cursors[0].pos,1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else |
|
|
|
if (k==BACK){ |
|
|
|
if (k==BACK){ |
|
|
|
if (cursors[0].pos==0){ |
|
|
|
if (cursors[0].pos==0){ |
|
|
|
if (cursors[0].line>0){ |
|
|
|
if (cursors[0].line>0){ |
|
|
|
cursors[0].pos=document[cursors[0].line-1].size(); |
|
|
|
cursors[0].pos=document[cursors[0].line-1].size(); |
|
|
|
document[cursors[0].line-1].append(document[cursors[0].line]); |
|
|
|
document[cursors[0].line-1].append(document[cursors[0].line]); |
|
|
|
document[cursors[0].line--].clear(); |
|
|
|
document.erase(document.begin()+cursors[0].line--); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
document[cursors[0].line].erase(cursors[0].pos---1,1); |
|
|
|
document[cursors[0].line].erase(cursors[0].pos---1,1); |
|
|
|