-
Notifications
You must be signed in to change notification settings - Fork 12
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
Highlighting range moves cursor #1
Comments
Cursor position is always restored after highlighting. See here. Try to comment out that line and let me now if that's the behavior you want. |
The cursor position is restored after pressing Enter to complete the command, but not immediately after the highlighted range is created. Commenting out that line merely prevents the cursor position from ever being restored. |
Please provide steps to reproduce. I don't use numbers at all so I'm having hard time grasping the issue. |
What delimiter are you using when the issue happens? I you use Take a look at: |
Sorry for such a late reply. Here are a couple recordings that show the issue. |
I uderstand now. You can achieve that behavior with the following: diff --git a/plugin/traces.vim b/plugin/traces.vim
index 77e23b1..1c25aa5 100644
--- a/plugin/traces.vim
+++ b/plugin/traces.vim
@@ -523,6 +523,7 @@ function! s:highlight(pattern_regex, selection_regex, last_specifier_pattern, ab
silent! call s:set_cursor_position(a:pattern_regex, a:selection_regex, a:abs_range)
endif
+ call cursor(s:cursor_initial_pos)
redraw
endfunction I could add an option, but that approach has a flaw. Patterns and ranges which are not present on starting screen will not be highlighted. Perhaps, it's better to utilize newly introduced autocommands, |
Thanks so much for your quick response! I confirm that does indeed fix the problem. Could you add it as an option, turned off by default? I like that behavior despite not highlighting patterns and ranges on the starting screen, and perhaps others will as well. |
When a range is highlighted, the cursor moves to the last line of the range until the command is executed. When using relative numbering this makes it hard to use commands like :t and :m, since the displayed relative numbers will change, but vim will still expect the relative numbers as displayed before the highlighting moves the cursor.
Is it possible to make a fix to keep the cursor position on the same line during the highlight, or alternatively create a setting to disable range highlighting for certain commands?
The text was updated successfully, but these errors were encountered: