-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
Detect when the user types past the last column in the terminal #257
Comments
Related to #240 |
Yeah there are a lot of bugs in this area... I am going to fix some known ones, and then we'll have to do another round of testing to see what's left :-/ Right now OSH has --completion-display=nice or =basic. I think I have to revert to the "basic" one unfortunately. The "nice" one is more like zsh, but probably has more bugs. Both of them have to known the terminal width, which is related to the SIGWINCH issue. I noticed that the Python interpreter, OSH, and readline are all fighting over SIGWINCH. |
I think we fixed most of the low hanging display bugs, and I plan to make a release today or tomorrow, so we can do another round of testing. However this one is somewhat fundamental. To restate the issue clearly:
Temporary workarounds:
|
Hm I noticed this https://tiswww.case.edu/php/chet/readline/readline.html#IDX238 |
Hooks that might help solve this problem (?) https://lists.gnu.org/archive/html/info-gnu/2014-02/msg00011.html
|
Discussion where I referenced this: https://oilshell.zulipchat.com/#narrow/stream/121540-oil-discuss/topic/interactive.20features I just tried out The bug right now is if you do TAB completion in osh, and the screen isn't wide enough, the current line "draws over" the completion candidates. In And yes the first screenshot in this issue shows this pretty much. |
note: yash also solves this problem and appears to do something pretty smart. |
Not essential since we're cutting the interactive shell for 2020 |
This is a nice summary of the problem of the terminal text reflowing. I also received multiple issues related to the terminal text reflow in ble.sh: akinomyoga/ble.sh#114 (comment), akinomyoga/ble.sh#142, and akinomyoga/ble.sh#154. Every time, I need to explain that this is caused by the undefined behavior of the terminal in text reflowing, and there is no perfect solution at the line-editor side. I think I can point the user to this section of powerlevel10k README next time I receive the same report. |
Yeah now that I look more carefully at the history of this issue, and at powerlevel10k, that is a related but distinct issue.
I think you're saying that in case 1 it's impossible to predict what the new distance is? But I think it's possible to handle case 2 if you control the whole line editor, which OSH doesn't. OSH is using GNU readline. (And I still haven't looked into the readline hooks I mentioned above) So I guess to sum up this issue, we can
I still would like to run ble.sh but I think that is further away unfortunately |
I guess I would add that situation #2 is more common than #1. That is, it is common to type a long line and have a narrow terminal, causing wrapping But if I resize my window, I'm used to having to do something to "reset" the state... i.e. using vim or tmux. Usually I tend to open new windows rather than resize existing ones, but some people may have different work habits |
Yes, it's impossible for the general terminal. But, of course, if the terminal and its version are specified, we can test the behavior of the terminal and write the code for that specific terminal. I have once checked the behavior of several terminals on the text reflow, but the problem is that every terminal has its own behavior slightly different from any other terminal. Some terminals remember that whether the automatic line folding at the end of the line has occurred or not for each line. Some terminals do not distinguish the whitespaces at the end of the line from the empty terminal cell (the state when nothing has been written to the cell). Some terminals try to become smarter and do something complicated, for which it is hard to predict the exact behavior from the external applications, etc.
Yeah. Anyway, full control of the line editor is needed for both cases 1 and 2. I guess it is hard to solve the problem of this issue (case 2 for completion candidates) as far as we are using GNU readline.
We could actually once run the core part of ble.sh on However, the problem that turned out then was that the initialization and the response to the user inputs were very slow with |
Oh really that would be very interesting -- do you have an idea of the missing features? Maybe we can discuss more on #653 or start a new issue for "ble.sh 2022 :)"
https://www.oilshell.org/release/0.9.6/test/spec.wwz/cpp/osh-summary.html What is good is that we can just write code in Python and that number goes up automatically. But what is bad is I haven't had time to work on it much since March 2021, since I've been working more on the Oil language, documentation, etc. So right now I am trying to accelerate the project by hiring a compiler engineer. I applied for 50K euros from this open internet fund: https://nlnet.nl/news/2021/20211201-call.html I think we will get a response by February 1st. And then I am setting up Github Sponsors / Open Collective now so we can take donations. There have been many readers for many years, so I think at least some of them will donate. I think it helps that the project is very concrete and it can absolutely be done with enough effort... there is no "risk". There are even some benchmarks of But it still can't run large programs. I think it is slightly slower than bash, but it is "hilariously unoptimized". I have no doubt that we could optimize it in C++ and get 2x speedup easily, and comparable memory usage to bash (maybe a little higher because of GC), but that has to happen after the 1900 spec tests pass! I noticed we stopped running ble.sh tests in our build awhile ago, let me re-enable it, which is #762 |
Hm this GNU readline configuration might let us avoid the issue? It can just scroll? Then if people want to avoid that, they can just hit
|
This addresses #257. A one line fix for a years old issue!
Horizontal scroll mode seems to do a good job, feedback welcome: https://www.oilshell.org/release/0.9.8/ |
This has a symptom similar to #252 and that's how I found it, but the cause I think is different. When completing a line which wraps to the next line, the completed line overwrite the suggestions:
When we backspace, it deletes the suggestions on the current line:
.
If we try to tab-complete again, it gets stranger: the cursor goes to the right of the screen and parts of the prompt get written on the new line.
This is probably caused by
core/comp_ui.py
not taking into account the line wrap.The text was updated successfully, but these errors were encountered: