-
Notifications
You must be signed in to change notification settings - Fork 35
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
Added: Delete by Indent & Keep Empty Lines + minor highlighting improvements #84
base: master
Are you sure you want to change the base?
Conversation
- Added a few missing conditions to Nim command highlighting.
If that Cleaning empty lines on save is good to reduce the whitespace noise in git commits. And even for editing I like it, as it is predictable. But an option not to do it is fine. |
I agree with @ReneSac that DeleteByIndent should be default. Also, I want to note that KeepEmptyLines still strips trailing whitespace from lines, it just keeps the empty ones (cause it was annoying me). My original plan was to have empty lines get stripped down to match the preceding indentation level if they exceeded it (so an intelligent strip), but ultimately it was just easier to keep empty lines, with practically the same result (i'm no longer annoyed). However, if that was a desired feature, it wouldn't be hard to add. |
Err.. I just realized the DeleteByIndent doesn't really work appropriately. It removes whitespace up to indentation width naively rather than dividing the line by indentation chunks, which doesn't work well when you're cursor is "between" tabs (or with actual \t tabs).. I need to improve this feature before you pull it please. |
On second thought, I don't want to scan the entire line when pressing delete and this works fine enough for me ATM. So just leave it off by default and feel free to pull the PR if you want. |
I'm not sure what DeleteByIndent actually does? |
It just deletes whitespace by indent count when you press backspace instead of deleting a single whitepsace at a time. It feels like un-indent, but isn't intelligent enough to actually delete to the next tab level in all situations. |
Couldn't you just emulate a press of Shift+Tab when Backspace is pressed? I'm also now not certain I like the keeping of whitespace in empty lines, is it really that difficult to reindent the line? I can already see one of these empty lines introduced in this PR and it already adds unnecessary noise. |
Looked for a way to un-indent the cursor in a gtksourceview on backspace, but didn't come up with anything.. I can't live without keepWhitespace on, sorry. There are a lot of editors which keep whitespace, so I don't see how other's contributing to Nim/Aporia using those is going to any different than having this option. Either way, you can enforce that PR's delete empty whitespace (or simply reject this PR and i'll just have it in my branch). |
What other editors do it this way? Isn't Shift+Tab the behaviour you want? |
Most other editors I've ever used keep whitespace by default: Visual Studios, GEdit, Kate/KDevelop.. There could be a better way (eg, delete the whitespace, but place cursor at indent level when it hits empty lines) but that's a lot more complicated and I'm not sure gtksourceview 2.0 would work with that well. Yes, Shift+Tab is the behavior I want to happen when you push backspace. I couldn't figure out how to do that or even if it was possible, so I just ran with deleting the spaces. |
Fixed bugs with type-sections under various conditions. Made type single-line/sections distinction. Minor improvement to command-calls space handling.
@dom96 I cleaned up a few more syntax issues and added some missing keywords (export, etc). I also removed the added whitespace in aporia.nim. What do you think about pulling this now? I'm switching away from Aporia for editing Nim as I've lived without Drag-n-Drop and proper Indentation features for too long now. But I don't want to leave Aporia with a broken syntax highlighting file. The keepEmptyLines/deleteByIndent settings are off by default (and you have to set them manually in the Raw Prefs to enable them) so I don't think it's a big deal to leave them there.. however, if you really don't like them I can remove them in order for you to pull this. Let me know your thoughts. |
No description provided.