-
Notifications
You must be signed in to change notification settings - Fork 596
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
Fixes = and == functionality to match VIM #502
Closed
Closed
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6669fdc
Fix == functionality to match VIM
6c3490d
Merge remote-tracking branch 'upstream/develop' into equal_equal
986fae7
Add = and == (filter) tests and documentation
b4b8b9a
Fix filter operation when all whitespace
8912cab
WIP: Close but no cigar
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@JugglerShu - Maybe you can help point me in the correct direction here. The problem is that I need to remove the whitespace from the actual line of the file here and write it back. This isn't happening here as I thought as the line below
test = FALSE;
should has 8 spaces. If you==
on that line in VIM all of the whitespace should be removed which is not happening.I have the range of the
whiteSpaceRange
and thefilterRange
as well as the substring of thefilterRange
. However what I'm not sure about is the best way to "edit" the line of the actual file to remove the whitespace or if if it's even allowed to edit from theNSTextView+VimOperation
. Just wanted to see what your thoughts were about this and how best to "edit" this line to remove all the found whitespace characters.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.
Maybe the way forward would be to find the start of the line you are on and the line the end position is on. yank that, filter it, delete the lines using
then insert the filtered text back using
both are methods on the category:
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.
Yeah that's one of the solutions I was thinking about too as well as just deleting all the text on the line if it's all whitespace however I wasn't sure if there was a more optimized solution. I was hoping for something more like NSString
stringByReplacingCharactersInRange:withString:
if possible though although I haven't found anything like that yet.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 doubt that it needs to be super optimized an operation as the files most people work on are on the order of 1000 LOC. this feature should be tested thoroughly with test cases though because it's potentially destructive.
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.
Yea, anything is fine as far as it is working.
But usually when you want to edit text in XVim text view, think followings in order.
I wonder if your code here is handled by an undo manager properly.
Let me know if you have further questions.
Thank you for your great improvements!
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.
Thanks for the great feedback @weaksauce and @JugglerShu. I'll update taking into consideration the ideas above and make sure I handle adding some more tests like for undo and visual. 👍