Marvin console improvements#385
Merged
Try merged 2 commits intoTry:masterfrom Jan 22, 2023
Merged
Conversation
Try
reviewed
Jan 18, 2023
| y-=fnt.pixelSize(); | ||
| if(i+1==log.size()) { | ||
| int x = margins().left + fnt.textSize(log[i]).w; | ||
| int x = margins().left + fnt.textSize(log[i].substr(0,cursPos)).w; |
Owner
There was a problem hiding this comment.
Would this line create(and destroy immediately) new string every frame? One string can't kill performance, but it's generally bad code.
- GthFont has overloads with iterators
- std::string_view
| } | ||
| if(e.key==Event::K_Delete) { | ||
| if(log.back().size()>cursPos) { | ||
| log.back().erase(cursPos,1); |
| if(e.key==Event::K_Back) { | ||
| if(log.back().size()>0) | ||
| log.back().pop_back(); | ||
| if(log.back().size()>0 && cursPos>0) { |
Owner
There was a problem hiding this comment.
Maybe something like
if(0<curssPos && curssPos<=log.back().size())
would be more clean way to express this condition?
Collaborator
Author
|
Addressed the changes. |
Owner
|
Merged, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A bit more convenience for marvin console.
The cursor is now moveable, the last input is preserved while moving through history and the delete key is usable.