Skip to content
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

fix: overwriting of line #76 #77

Merged
merged 3 commits into from
Jun 25, 2021
Merged

Conversation

ahkrr
Copy link
Contributor

@ahkrr ahkrr commented Jun 23, 2021

This happened, because the prompt would be drawn at the origin, which was determined to be at the position()?, which was in the previous line.
Now, move one line downwards before determining the origin.

src/engine.rs Outdated
@@ -768,6 +768,8 @@ impl Reedline {

let mut terminal_size = terminal::size()?;

self.stdout.queue(Print("\r\n"))?.flush()?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we always want to send a crlf? I was wondering if we may just want to see that we're at the bottom of the screen and scroll the screen up a line if so.

@ahkrr
Copy link
Contributor Author

ahkrr commented Jun 24, 2021

While thinking about this issue, I noticed that maybe reedlines use in main.rs should result in behavior like this

/home/hk/Dokumente/rus_test/reedline      06/24/2021 11:32:24 PM
〉ls
Our buffer: ls

/home/hk/Dokumente/rus_test/reedline      06/24/2021 11:32:26 PM
〉

because in main.rs
line_editor.print_line(&format!("Our buffer: {}", buffer))?;
is called, which prints a \n at the end placing the cursor in the next row.
If an "application" would print a line without a trailing newline, this line would have been eaten by reedline previously.
The new changes now lead to the output looking like the example above.

@ahkrr
Copy link
Contributor Author

ahkrr commented Jun 24, 2021

Or should it be detected, if the position is already at (0, some_row) -> work from here,
and if the position is ( column > 0, some_row) -> start in the next line

@ahkrr
Copy link
Contributor Author

ahkrr commented Jun 24, 2021

oh-my-zsh
> printf "jo"
jo%
oh-my-zsh
> printf "jo\n"
jo
oh-my-zsh
>

this is an example from zsh with oh-my-zsh

@sophiajt
Copy link
Contributor

@ahkrr yeah, we could put the logic in to detect if we're not in the 0th column. Do you want to do that in a separate PR?

@ahkrr
Copy link
Contributor Author

ahkrr commented Jun 25, 2021

Lets do that in a separate PR.

@sophiajt sophiajt merged commit 30bede6 into nushell:main Jun 25, 2021
@sophiajt
Copy link
Contributor

sounds good

sholderbach added a commit to sholderbach/reedline that referenced this pull request Dec 19, 2021
Additional line was a crutch introduced to counteract misbehavior fixed
in nushell#77

Similar behavior was already sneaked into engine-q with nushell/engine-q#508
sholderbach added a commit that referenced this pull request Dec 19, 2021
Additional line was a crutch introduced to counteract misbehavior fixed
in #77

Similar behavior was already sneaked into engine-q with nushell/engine-q#508
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants