Repository navigation
Conversation
by printing the line with a method that doesn't advance the cursor position, and by handling the cooked cursor appropriately when it is located at the last column. this also prevents the occasional flicker of the cursor at the beginning of the line whenever the line is updated. note that with this change to output(), it is now identical to blankout(). further work could involve merging the two. alternately, consider moving the creation of a line of spaces into blankout() where it belongs, and changing its function parameters accordingly.
local and gitbug branches diverged bcz I sync'ed the github branch.
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.
Important
this PR has had all of five minutes of testing on one Windows 10 Pro computer. it probably should receive more testing before it is integrated into such a core part of DFHack.
Note
on the other hand, I am very confident of this code change, because blanking the line beyond the currently-valid text is done with the same API call. Tried and tested.
this PR changes the way output is printed to the console line being edited. the previous code advanced the cursor while updating the displayed text. this malfunctioned at the end of the line:
if a character was printed in the rightmost column, the cursor would move to the next line, causing the line editor to use that line. this would occur over and over with every character added or deleted.
Important
does nobody else experience this? I couldn't find a relevant issue.
now the text being edited remains on the same line, scrolling horizontally as necessary.
as a beneficial side effect, this PR removes the occasional flicker of a cursor at the start of a line of input, that could previously be seen as characters were added or deleted to the text being edited.
this PR does not resolve the issue that occurs when the console window is resized such that the resulting number of columns is less than the total length of (the prompt + the line of input). Window still spuriously wraps the line of text into the next row, scrolling the screen if necessary.
but this PR does improve that issue. the extra lines of text that the previous code left in the buffer were wrapped as if they were one long line of text, which resulted in many more spurious characters on the resized screen.
I think fixing this properly would require a callback to catch some window-resized event, and that's just not something I'm going to learn to do.
Note
code quality:
you will notice that the revised
output()function is now identical to theblankout()function. I am willing to merge them, or I am willing to reviseblankout()to calloutput(). if I do the latter, I will probably also move the creation of a string of spaces intoblankout()instead of making its callers do that.