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

Backspace is not working properly in the output window #700

Closed
glebovmaksim opened this issue Jul 29, 2020 · 14 comments
Closed

Backspace is not working properly in the output window #700

glebovmaksim opened this issue Jul 29, 2020 · 14 comments
Labels
bug Something isn't working output/repl window

Comments

@glebovmaksim
Copy link

glebovmaksim commented Jul 29, 2020

Sometimes it deletes the prompt itself. Here is the gif.

Peek 2020-07-29 15-59

Was surprised that it actually worked on the first expression, but after trying to remove an empty brackets it started to fail every time.

@bpringe
Copy link
Member

bpringe commented Jul 29, 2020

I'm unable to reproduce. What's your OS? And what version of Calva are you on? In version 2.0.110 backspacing through the prompt is not allowed. I also see a space being added after your evaluation result, which doesn't happen for me.

@bpringe
Copy link
Member

bpringe commented Jul 29, 2020

I see now that you're saying the disabling of backspace is not being respected after deleting the empty list. But again, I cannot repro. =(

@glebovmaksim
Copy link
Author

glebovmaksim commented Jul 29, 2020

OS: Ubuntu 18.04.1.
Calva: 2.0.110. Reinstallation did not help =(

Some additional information:

  • It happens after deleting any empty datastruct affected by Paredit.
  • Since deleting the empty datastruct is the last step of deleting every form in Paredit, the problem becomes worse.
  • In Cave Man Paredit mode backspacing always works, no restrictions at all.

Sometimes it does work, but mostly not. Could it be some concurrency problem?
Peek 2020-07-29 20-34

@PEZ
Copy link
Collaborator

PEZ commented Jul 29, 2020

It's interesting that the whole buffer seems to break the syntax highlighting... What other extensions are you using? I've seen Clover conflicting.

@PEZ
Copy link
Collaborator

PEZ commented Jul 29, 2020

I can reproduce this. Very interesting!

@PEZ
Copy link
Collaborator

PEZ commented Jul 29, 2020

When deleting the empty list, all trailing spaces in the window are deleted. My mind is blown.

@bpringe
Copy link
Member

bpringe commented Jul 30, 2020

I can reproduce now too. Weird.

@bpringe bpringe added bug Something isn't working output/repl window labels Jul 30, 2020
@PEZ
Copy link
Collaborator

PEZ commented Jul 30, 2020

And now I can't reproduce it any longer. So strange!

@glebovmaksim
Copy link
Author

Let me show you something crazy. It's even reproducible!

Peek 2020-07-30 19-03

@glebovmaksim
Copy link
Author

Another random weird thing. Disappeared after cleaning the file.

Peek 2020-07-30 23-00

@gustavobertolino
Copy link

gustavobertolino commented Aug 7, 2020

Same behavior here : (

calva-repl-output-bug

It doesn't affect any part of my code, neither the IDE, but it something bad from the user experience point of view.

@glebovmaksim
Copy link
Author

glebovmaksim commented Aug 8, 2020

@PEZ, @bpringe, I've found the source of the problem. This behavior occurs because Calva formats the entire file, which happens in two cases:

  • After removing any root pair paranthesis (because of this and this). I doubt it's intentional, maybe it should be fixed. Please correct me if I'm wrong.
  • By pressing tab on an empty line. This is fine in a regular file, but in the output file it deletes all trailing spaces next to prompt and breaks it. I think we should not allow to format the entire output file at all, because on a longer session it may grow to a large size, resulting in (possible) slow formatting. And it doesn't seem like a useful feature here.

I can send a pull request if you point me in the right direction to fix this 😄

@PEZ
Copy link
Collaborator

PEZ commented Aug 9, 2020

Ah, yes, that makes sense! I was looking at the wrong place...

So, many paredit commands finish with formatting and probably we (implicitly or explicitly) tell the formatter to trim trailing whitespace.

Iirc there is a special case for when formatting is performed on the top level. Or, rather, for selecting what is to be formatted. A check there for if it is the output file could maybe stop this madness. Also trimming trailing whitespace is generally a bad idea in this window.

PR is super welcome. Please don't hesitate to ask us for help.

@bpringe
Copy link
Member

bpringe commented Aug 9, 2020

@glebovmaksim Great find! Looks like you're looking in the right places already, though I haven't messed with the formatting much myself.

@PEZ Maybe when formatting, if it's the repl file, we should only format up to the previous prompt?

glebovmaksim pushed a commit to glebovmaksim/calva that referenced this issue Aug 17, 2020
glebovmaksim pushed a commit to glebovmaksim/calva that referenced this issue Aug 17, 2020
PEZ added a commit that referenced this issue Aug 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working output/repl window
Projects
None yet
Development

No branches or pull requests

4 participants