diff --git a/main/main.cpp b/main/main.cpp index 016d5f9..be09017 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -110,12 +110,12 @@ int main() { vkvm::callEvent(vkvm::EventType::RenderText); } - if(vkvm::KeyCode::Arrow_Up == keycode){ - terminal.moveup(); - std::cout << terminal.getString() << std::endl; - vkvm::setText(terminal.getString()); - vkvm::callEvent(vkvm::EventType::RenderText); - } +// if(vkvm::KeyCode::Arrow_Up == keycode){ +// terminal.moveup(); +// std::cout << terminal.getString() << std::endl; +// vkvm::setText(terminal.getString()); +// vkvm::callEvent(vkvm::EventType::RenderText); +// } diff --git a/src/Terminal.cpp b/src/Terminal.cpp index 7149c3d..4ff6866 100644 --- a/src/Terminal.cpp +++ b/src/Terminal.cpp @@ -140,16 +140,18 @@ void Terminal::movedown() { if (s[i] == '\n') { count = 0; } - else {if(s[i]!=cursor) - count++; + else { + if(s[i]!=cursor) + count++; } - if(count == 21){ + if(count == 22){ s = s + s[s.length() - 1]; int x = s.length() - 1; for(; x > i; x--){ s[x] = s[x-1]; } s[x] = '\n'; + count = 0; } } std::cout<<"plus enter:" + s < i; x--){ - s[x] = s[x-1]; - } - s[x] = '\n'; - } - } - std::cout<<"plus enter:" + s <= 0); - std::cout<<"cursorpositon:" + std::to_string(cursorposition)<= (cursorposition - beforcursorenter)) { - for(int newcursorposition = cursorposition;newcursorposition < (aftercursorenter1 + cursorposition -beforcursorenter -1);newcursorposition++){ - s[newcursorposition] = s[newcursorposition + 1]; - } - s[aftercursorenter1 + cursorposition - beforcursorenter -1] = cursor; - } - else{ - for(int newcursorposition = cursorposition;newcursorposition < (aftercursorenter2); newcursorposition++){ - s[newcursorposition] = s[newcursorposition + 1]; - } - s[aftercursorenter2] = cursor; - } - - } - else{ - std::cout<<"enter the loop & aftercursorenter2 ==s.npos" <= (cursorposition - beforcursorenter)) { - std::cout<<"enter the loop if" < i; x--){ +// s[x] = s[x-1]; +// } +// s[x] = '\n'; +// } +// } +// std::cout<<"plus enter:" + s <= 0); +// std::cout<<"cursorpositon:" + std::to_string(cursorposition)<= 0); +// +// +// std::cout<<"aftercursorenter2:" + std::to_string(aftercursorenter2)<= (cursorposition - beforcursorenter)) { +// for(int newcursorposition = cursorposition;newcursorposition < (aftercursorenter1 + cursorposition -beforcursorenter -1);newcursorposition++){ +// s[newcursorposition] = s[newcursorposition + 1]; +// } +// s[aftercursorenter1 + cursorposition - beforcursorenter -1] = cursor; +// } +// else{ +// for(int newcursorposition = cursorposition;newcursorposition < (aftercursorenter2); newcursorposition++){ +// s[newcursorposition] = s[newcursorposition + 1]; +// } +// s[aftercursorenter2] = cursor; +// } +// +// } +// else{ +// std::cout<<"enter the loop & aftercursorenter2 ==s.npos" <= (cursorposition - beforcursorenter)) { +// std::cout<<"enter the loop if" <