-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve heuristic for when to refresh line in the REPL #17868
Conversation
((position(s.input_buffer) + sizeof(s.p.prompt) + sizeof(str) - 1) < width(terminal(s))) | ||
edit_insert(buf, str) | ||
if !('\n' in str) && eof(buf) && | ||
((line_size(s) + sizeof(s.p.prompt) + sizeof(str) - 1) < width(terminal(s))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sizeof(s.p.prompt)
only applies to the first line. the other lines use s.indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case someone somewhere has s.indent != strwidth(s.p.prompt)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, updated.
Any further comments here? @vtjnash for the last commit with |
* improve heuristic for when to refresh line * fix trailing whitespace... * use indent when not on first line * remove unused argument and change local var to not share name with function (cherry picked from commit f84b94c)
* improve heuristic for when to refresh line * fix trailing whitespace... * use indent when not on first line * remove unused argument and change local var to not share name with function
Comparing pasting the same long function in the REPL before PR (above) and after PR (below): https://media.giphy.com/media/3o6Ztmlq9XLVMTqDgA/giphy.gif. The before PR version was going quite a while after I turned of the recording. Still not perfect, but better.
cc @vtjnash @Keno
Sort of fixes [no auto close] #15787