Comments (9)
Update: This is definitely an issue with PrettyPrompt
as I was able to use the example code and reproduce this exact behavior. The higher the key repeat speed, the easier it breaks.
from prettyprompt.
Narrowed this down to an issue in the core .NET libs. dotnet/runtime#88343
In the meantime, I think we can do a workaround to remove a call to Console.CursorTop
which is ultimately causing the issue.
from prettyprompt.
Upon closer inspection, it seems that the problem arises because the program appears to push byte-by-byte. I was able to confirm this by making it print the ? character just from tapping ä
and '
at the same time with some luck. A character that spans multiple bytes can have its first byte written, then a different character, and then the aforementioned character's remaining bytes. As a result, the resulting string is not valid UTF-8.
As an example, if I were to type a
and ä
just right, it probably appends the first ä
byte 195
, then the a
byte 97
, then the ä
byte 164
. The resulting buffer becomes [195, 97, 164]
when it should have been [195, 164, 97]
.
from prettyprompt.
Hi @Emik03, thank you for the bug report and research. I'm not currently able to reproduce this. Would you mind sharing which terminal and OS you're using?
Also, does this still happen if start CSharpRepl with the --useUnicode true
flag? I'm guessing it does still happen as that doesn't change how bytes are sent to the terminal, but just looking to narrow down differences between my setup and yours. Thanks!
from prettyprompt.
It indeed does happen regardless of the value set in useUnicode
.
I can still replicate this after removing config.rsp
and prompt-history
, then launching it with no arguments.
OS: Pop!_OS 22.04 LTS x86_64
Shell: bash 5.1.16
DE: GNOME 42.5
Terminal: gnome-terminal
Layout: Swedish (no dead keys)
from prettyprompt.
I suspect it might be to do with how Windows uses UTF16 everywhere, which includes command-line interfaces, meanwhile Linux uses UTF8.
from prettyprompt.
Nice, thanks for that. I'm able to reproduce this on Windows Terminal with Ubuntu on WSL. Cannot reproduce at all on Windows Terminal on Windows.
from prettyprompt.
Note for myself:
- This appears to have broken between 0.5.1 and 0.6.0 of CSharpRepl (at least for my repro steps on WSL).
- Tracking this down to PrettyPrompt, it broke between v4.0.1 and v4.0.2 of PrettyPrompt.
- Verified that if I make CSharpRepl compile against PrettyPrompt v4.0.1 (requires a bit of hacking and slashing due to API differences) the issue goes away.
So the offending change is somewhere in here: v4.0.1...v4.0.2
from prettyprompt.
I've implemented this in the underlying PrettyPrompt library, when we upgrade that library CSharpRepl will get this fixed. Thanks for the report!
from prettyprompt.
Related Issues (20)
- Completion pane over the caret
- Invalid behavior in Windows Terminal HOT 2
- Invalid positioning of completion pane "scrolling inputs"
- Do not draw empty documentation box when no completion item is selected
- Make it possible to update PromptConfiguration.Prompt
- Overload pane may stay on screen after the input submission
- Improve cursor positioning when escaping text selection
- Input is invisible when prompt line's length is larger then window width
- Invalid completion pane size after scroll-up
- Invalid position of completion pane for long multiline input
- Inability to get to start of long multiline inputs HOT 1
- Crash while multiple Shift+Delete pressing
- Improve linux missing xsel errors
- Invalid text wrapping
- Input needs to be length-limited so it fits into console buffer HOT 1
- Non-base64 string in prompt-history causes unhandled exception HOT 1
- Pasting 🤦🏼♂️character into repl throws exception and exits repl HOT 4
- Readme Usage is Incorrect.
- Is it possible to add new events to CompletionPane.Open or Close?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettyprompt.