rc grep/make: don't touch user selections
Since the default make error pattern spans until the end of the line, make-jump select the whole line, moving the cursor to the end. This is especially bad when the error message is very long and hence the cursor movement scrolls the viewport so the file:line:col is no longer visible. Stop moving the cursor in `*make*` and `*grep*` buffers. We already have highlighting to indicate the current line.
This commit is contained in:
parent
847bf98b47
commit
88aff72bc8
|
@ -52,11 +52,14 @@ declare-option -docstring "name of the client in which all source code jumps wil
|
||||||
str jumpclient
|
str jumpclient
|
||||||
|
|
||||||
define-command -hidden grep-jump %{
|
define-command -hidden grep-jump %{
|
||||||
evaluate-commands %{ # use evaluate-commands to ensure jumps are collapsed
|
evaluate-commands -save-regs a %{ # use evaluate-commands to ensure jumps are collapsed
|
||||||
try %{
|
try %{
|
||||||
execute-keys 'xs^([^:\n]+):(\d+):(\d+)?<ret>'
|
evaluate-commands -draft %{
|
||||||
|
execute-keys ',xs^([^:\n]+):(\d+):(\d+)?<ret>'
|
||||||
|
set-register a %reg{1} %reg{2} %reg{3}
|
||||||
|
}
|
||||||
set-option buffer grep_current_line %val{cursor_line}
|
set-option buffer grep_current_line %val{cursor_line}
|
||||||
evaluate-commands -try-client %opt{jumpclient} -verbatim -- edit -existing %reg{1} %reg{2} %reg{3}
|
evaluate-commands -try-client %opt{jumpclient} -verbatim -- edit -existing -- %reg{a}
|
||||||
try %{ focus %opt{jumpclient} }
|
try %{ focus %opt{jumpclient} }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,20 +52,24 @@ define-command -hidden make-open-error -params 4 %{
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden make-jump %{
|
define-command -hidden make-jump %{
|
||||||
evaluate-commands -save-regs / %{
|
evaluate-commands -save-regs a/ %{
|
||||||
|
evaluate-commands -draft %{
|
||||||
|
execute-keys ,
|
||||||
try %{
|
try %{
|
||||||
execute-keys gl<a-?> "Entering directory" <ret><a-:>
|
execute-keys gl<a-?> "Entering directory" <ret><a-:>
|
||||||
# Try to parse the error into capture groups, failing on absolute paths
|
# Try to parse the error into capture groups, failing on absolute paths
|
||||||
execute-keys s "Entering directory [`']([^']+)'.*\n([^:\n/][^:\n]*):(\d+):(?:(\d+):)?([^\n]+)\n?\z" <ret>l
|
execute-keys s "Entering directory [`']([^']+)'.*\n([^:\n/][^:\n]*):(\d+):(?:(\d+):)?([^\n]+)\n?\z" <ret>l
|
||||||
set-option buffer make_current_error_line %val{cursor_line}
|
set-option buffer make_current_error_line %val{cursor_line}
|
||||||
make-open-error "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}"
|
set-register a "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}"
|
||||||
} catch %{
|
} catch %{
|
||||||
set-register / %opt{make_error_pattern}
|
set-register / %opt{make_error_pattern}
|
||||||
execute-keys <a-h><a-l> s<ret>l
|
execute-keys <a-h><a-l> s<ret>l
|
||||||
set-option buffer make_current_error_line %val{cursor_line}
|
set-option buffer make_current_error_line %val{cursor_line}
|
||||||
make-open-error "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}"
|
set-register a "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
make-open-error %reg{a}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command make-next-error -docstring 'Jump to the next make error' %{
|
define-command make-next-error -docstring 'Jump to the next make error' %{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user