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,19 +52,23 @@ 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/ %{
|
||||||
try %{
|
evaluate-commands -draft %{
|
||||||
execute-keys gl<a-?> "Entering directory" <ret><a-:>
|
execute-keys ,
|
||||||
# Try to parse the error into capture groups, failing on absolute paths
|
try %{
|
||||||
execute-keys s "Entering directory [`']([^']+)'.*\n([^:\n/][^:\n]*):(\d+):(?:(\d+):)?([^\n]+)\n?\z" <ret>l
|
execute-keys gl<a-?> "Entering directory" <ret><a-:>
|
||||||
set-option buffer make_current_error_line %val{cursor_line}
|
# Try to parse the error into capture groups, failing on absolute paths
|
||||||
make-open-error "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}"
|
execute-keys s "Entering directory [`']([^']+)'.*\n([^:\n/][^:\n]*):(\d+):(?:(\d+):)?([^\n]+)\n?\z" <ret>l
|
||||||
} catch %{
|
set-option buffer make_current_error_line %val{cursor_line}
|
||||||
set-register / %opt{make_error_pattern}
|
set-register a "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}"
|
||||||
execute-keys <a-h><a-l> s<ret>l
|
} catch %{
|
||||||
set-option buffer make_current_error_line %val{cursor_line}
|
set-register / %opt{make_error_pattern}
|
||||||
make-open-error "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}"
|
execute-keys <a-h><a-l> s<ret>l
|
||||||
|
set-option buffer make_current_error_line %val{cursor_line}
|
||||||
|
set-register a "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
make-open-error %reg{a}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user