Add a "Go to Line/Column" dialog#133
Conversation
|
@microsoft-github-policy-service agree |
| let parts: Vec<_> = line.splitn(2, ':').collect(); | ||
| Ok(match parts.len() { | ||
| 1 => { | ||
| if let Ok(line) = parts[0].parse::<i32>() { |
There was a problem hiding this comment.
FYI: this allows negative numbers, e.g. -123, 1:-32.
This seems to be handled well by the editor (looks like it just goes to the nearest valid spot), but it might be a better experience to mark negative numbers as invalid
There was a problem hiding this comment.
Parsing negative values as invalid does not sound like a right choice to me, but there are multiple ways to handle them:
- wrap to 0 (e.g., vscode uses this logic for column number, my implementation)
- use relative numbering (e.g., vim uses it)
- use "python indexing", aka -1 == count from the end (vscode uses for lines)
And probably maintainers should decide which one.
There was a problem hiding this comment.
I think the "python indexing" idea would be interesting.
And I agree that the maintainers should have the final say.
It looks like the logic is here (clamp x and y to be positive):
Line 1300 in d74c330
There was a problem hiding this comment.
Probably, if vscode was supposed to be a prototype in a sense. But I want to point out, that wrapping logic is not buffer's logic, it's the logic of the goto, so the calculation should be done in goto handling, in draw_editor.rs
|
I was also working on this. (Ended up using a top bar similar to the But here some consideration I made that you may find useful, cheers 😄.
|
|
I'm receiving a lot of comments and PRs at the moment, and I may need a few days to get back to this one. I apologize for that. (I took a cursory glance though and this looks super cool!) |
|
Is this PR alive? |
|
Yes, but my intention was to check this out next week. I'll give it a look now. |
|
Oh, no rush, you just told that in few days and almost all other PRs had changes requested, so I thought that you may have overlooked it. |
|
Yeah, that's a fair assumption. I do overlook PRs from time to time, because there's genuinely a lot of them. 😅 I made changes and wrote feedback over in this commit: c5f26b9 The important part is the early-return (which is a bug in your code) and the missing translations. The other bits can be considered suggestions. 🙂 |
lhecker
left a comment
There was a problem hiding this comment.
I'll set this as "Changes requested" again. I do try to read every comment/update so I should not miss it when you respond / push changes. But if I do, please ping me again. Thanks!
|
Made requested changes + rebased the branch to master (I lost my patched unix.rs and I am working on Mac, and mac pr was merged prior). |
lhecker
left a comment
There was a problem hiding this comment.
Thank you for making these changes!
Since issue had
E-help-wanted, I figured I can try to implement the Goto. Would be glad to see the feedback. I haven't done any localization yet.Closes #21