Commit Graph

28 Commits

Author SHA1 Message Date
Andy Stewart
fdecc23368 Hunk previews highlight intra-line changes.
Closes #577.
2019-09-18 11:55:01 +01:00
Andy Stewart
88d396f1b4 Add :GitGutterQuickFix command.
It loads all hunks into the quickfix list.

Closes #617.
2019-08-28 11:59:19 +01:00
Andy Stewart
307caf6f39 Extract general assert method. 2019-08-28 11:56:52 +01:00
Andy Stewart
2364d14242 Fix test logic when no signs expected. 2019-08-28 11:41:09 +01:00
Andy Stewart
7dfbb8be11 Fix incorrect expectations in test. 2019-08-22 15:16:43 +01:00
Andy Stewart
5458e3db8a Use feedkeys() so cabbrev sees it. 2019-08-22 15:15:54 +01:00
Andy Stewart
77fb3fd81e Enable :w in preview window to stage the hunk. 2019-08-21 10:27:23 +01:00
Andy Stewart
cbaa22e38c Use sign functions, groups, and priority, where available.
On Vims that support it, signs are placed in the "gitgutter" group with
a priority set by g:gitgutter_sign_priority.

Closes #544.
Closes #576.
Closes #627.
2019-08-16 16:21:06 +01:00
Andy Stewart
070cfc531a Move to line more idiomatically. 2019-08-13 16:02:12 +01:00
Andy Stewart
b036fcf527 Stage part of any hunk.
See #279.
2019-08-13 15:57:22 +01:00
Andy Stewart
bc1d28db46 Allow staging part of an additions-only hunk.
See #279.
2019-08-12 17:19:05 +01:00
Andy Stewart
5bb4f14ed3 Fix tests in light of sign-priority. 2019-05-29 13:04:39 +01:00
Andy Stewart
1d422b9f98 Revert to non-binary writefile() for writing buffer.
The previous commit switched use of writefile() to binary mode so that
we could prevent a newline being added to a completely empty buffer.
Evidently, however, binary mode has side effects (see #567) so this
commit returns to non-binary mode - with a simpler fix for completely
empty files.

Unfortunately this implementation does not work for noeol files - see
the failing test - because writefile() does not take account of
'nofixeol' (unlike :write).  This is suboptimal but acceptable because
noeol files are not be encountered often.

See #567.
2018-12-15 14:55:14 +00:00
Andy Stewart
5c636b128e Fix handling of buffer consisting only of a newline.
See #510.
2018-12-13 10:50:02 +00:00
Andy Stewart
3f642a0bb8 Add assertion for path of untracked file. 2018-11-17 17:24:48 +00:00
Andy Stewart
947737c76f Handle non-ASCII paths.
This prevents git-ls-files from escaping "unusual" characters in
pathnames.  When this happened, gitgutter would feed the escaped name
back to git-show but git-show would not recognise it.

This commit makes git-ls-files use the -z option to output pathnames
verbatim.  These pathnames also become null terminated so we have to
ensure we remove the null terminator too.

Closes #562.
2018-11-17 11:24:36 +00:00
Andy Stewart
0597380f6b Prompt user to choose hunk when overlapping.
See #556.
2018-10-18 15:39:55 +01:00
Andy Stewart
89c34f74cb Display unambiguous sign when hunks overlap.
See #556.
2018-10-18 09:45:55 +01:00
Andy Stewart
a7206c41fc Add test for files with leading dash. 2018-05-08 16:26:48 +01:00
Andy Stewart
72226496b3 Add test for encoding conversion. 2018-03-14 14:44:33 +00:00
Andy Stewart
5db4a3a2a5 Make robust the replacement of temp file paths with actual paths.
The previous implementation meant the temp file paths were treated as
regular expressions, which was vulnerable to problems with backslashes
etc.

See #494.
2018-03-02 12:44:49 +00:00
Andy Stewart
e9aee00190 Switch off diff.mnemonicPrefix in tests.
Follows on c325a8b.
2018-02-22 11:04:10 +00:00
Andy Stewart
798abe53b3 Extract helper for triggering gitgutter. 2018-02-21 11:33:44 +00:00
Andy Stewart
35c92dbd50 Add test for user autocmd. 2018-02-21 11:31:48 +00:00
Andy Stewart
ef94b195ab Add tests for text objects. 2018-02-19 10:51:21 +00:00
Andy Stewart
d137753182 Handle &write option being off (e.g. vim -m FILE).
See #407.
2018-02-12 16:19:01 +00:00
Andy Stewart
5bfe5b9209 Big refactor.
- Hunk stage/undo/preview no longer saves the buffer.
- Hunk undo no longer makes locations go out of sync.
- Grep can be opted out of (grep output with ansi escapes is number one cause
  of issues).
- Replaced g:gitgutter_grep_command with g:gitgutter_grep.
- Always runs git-diff the same way instead of in two possible ways.
- Separated detection of git tracking from diffing.
- Simplified path handling.
- Removed support for xolox shell: Windows taskbar does not flash with async
  jobs.
- Removed g:gitgutter_{eager,realtime}.
- Simplified implementation generally.
2018-02-12 14:25:11 +00:00
Andy Stewart
ee481585d7 Modernise tests.
Use Vim's built-in assert_*() functions and vim-contest test runner.
2016-10-27 12:15:43 +02:00