-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
Paredit and highlight fixes and improvements. #456
Conversation
positions outside an sexpr. Closes: #417.
That double-click is great! We should add it to the editor as well. (Not in this PR, though. 😄 ) |
Double-clicking inside a string should probably not use grow-selection. It makes it hard to select words in the string. |
Undoing wrap selection deletes the selection. I think this might be an old bug. |
Those are the only things I find when testing. The rest works wonderfully as advertised. |
You mean clicking in something like this |
I take a look at this as well. |
Yes. It is both good and bad that the whole string is selected, I guess. But it ”feels” weird. |
I can not reproduce this for the wrap around commands. The behavior with |
from the current offset in the model.
src/webview/token-cursor.ts
Outdated
/** | ||
* Indicates if the current token is inside a string (e.g. a documentation string) | ||
*/ | ||
isInString() { |
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.
I thought we already had a method for checking if we're inside a string? Or maybe that is only while parsing... But even if it is, maybe add that fact to the token?
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.
If so I didn't found it and the decision if in a string may depend on the next and previous token so I think this method is correctly placed in the token cursor because only the cursor has the whole picture of the model.
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.
I was remembering correctly 😄
calva/src/webview/token-cursor.ts
Line 414 in 786d6dd
withinString() { |
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.
Hey cool! But I think the code is not sufficient. I will test it.
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.
What seems a bit odd to me is that double-clicking words work everywhere on in the REPL window, except the prompt. Is there a reason for that, you think? (I'm talking about the released Calva.)
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.
That's because outside the line model the default behavior of the double click is in place. We override the default for mouse events to set the blinking cursor on the right place. My new code takes care that this default behavior is preserved outside the line model.
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.
My new code takes care that this default behavior is preserved outside the line model.
Yes. I saw that.
I now tried this a bit more and realise we have quite a few different behaviours. If I use the Wrap around ()` command on a left->right selection, the right thing is selected and I can undo the wrap around w/o undoing something else as well. However:
OK. So complicated to follow, here's a gif: Crazy, huh? 🤔 |
Much less crazy now! 😄 I think a new issue arrived. I can't move the cursor right with key-right. It instead selects the character to the right w/o moving the cursor, and then the cursor won't move either left or right. Also:
|
no selection to restore previous behavior.
Yes the cursor movement depends on the "direction" of the selection. I fixed that.
Yes that was wrong.
I am really not sure, what you doing. I do this:
And the same for this one: I am doing this - selecting both directions and execute |
I type the character |
Okay then we are doing the same - it is
Is this still present for you with the latest commits? |
Did you typed that On my system the changes in the model are played correctly back in order (Windows and Linux). |
It doesn't matter if I am in strict mode or not. Or if I am doing this on something in the repl history or something I have just typed. The redo bug is not new, btw. I just tried it in the released Calva. I'll file an issue about it. |
On my systems the undo/redo works like a charm in both directions. Looking further into this tomorrow. |
@PEZ By the way is there a specific reason that the redo command in the REPL is |
Maybe because it is On my machine redo is |
Mayby. gg On my stock vscode installation on Windows redo is |
Yes. And I have reached the limit to my testing of this since things are crazy on macOS anyway. Let's merge and we will find out. Especically together with my lexing fix things will work pretty much better than they do today with this PR. After that, we're almost ready to take on Paredit in the editor. Haha. |
What has Changed?
paredit.open()
method to wrap around the current selection ([2.0] Paredit inconsistencies #170 ).open()
andwrapSexpr()
.insertString()
to usechangeRange()
directly.dblclick
handler to the webview to executegrowSelection()
on mouse double click starting at the current position of the mouse pointer. This allows the selection of words with a double click like in the editor.growSelection()
method to allow cursor positions outside an sexpr (Expand selection fails at the start and end of the input of the REPL window #417).comment
form #403).Disables the call to
util.select()
for theparedit.deleteBackward
command to avoid misplaced cursor position after a line was deleted ([Paredit/Editor] paredit.deleteBackward sets cursor position wrong when deleting a line. #458).Fixes #170 #417 #403 #458
My Calva PR Checklist
I have:
dev
branch. (Or have specific reasons to target some other branch.)master
. (Sorry for the nagging.)ci/circleci: build
test. (For now you'll need to opt in to the CircleCI New Experience UI to see the Artifacts tab, because bug.)[Unreleased]
entry inCHANGELOG.md
, linking the issue(s) that the PR is addressing.The Calva Team PR Checklist:
Before merging we (at least one of us) have:
dev
branch (unless reasons).Ping @PEZ, @kstehn, @bpringe