Commit Graph

78 Commits

Author SHA1 Message Date
Andy Stewart
e288dd4733 Suppress echoing of preview window file name
The file name does not mean anything so it is unhelpful to show it.
Not showing it avoids the hit-enter prompt which can occur.
2021-04-22 15:37:28 +01:00
Vincent Cordobes
42ed714fb9 Capitalize warning messages 2021-04-22 12:03:06 +01:00
Andy Stewart
9756e95bd5 Fix resizing of existing non-floating hunk preview window
This bug was introduced by 9784226 in #708.  It had the effect of not
allowing an existing hunk preview window to increase in size for a
larger hunk (up to 'previewheight').

See #775.
2021-04-13 15:18:27 +01:00
Andy Stewart
24cc477895 Avoid cursor in unexpected window after Esc in preview
Thanks @andymass for the patch.

See #769.
2021-03-19 16:31:26 +00:00
Andy Stewart
64062dfe02 Simplify opening of preview window 2021-03-16 12:06:31 +00:00
Andy Stewart
f3145958dd Make statusline blank in hunk preview window
I would prefer to remove the statusline altogether in the hunk preview
window, making it consistent with the floating preview window.  However
I do not think that is possible; the best one can do is make it blank.
2021-03-15 17:00:33 +00:00
Andy Stewart
6019d43860 Ensure hunk summary is updated during a hunk op
Fixes #765.
2021-02-16 16:04:47 +00:00
Andy Stewart
f440ed04dd Enable <Esc> to close floating preview window
See #718.
2021-02-08 12:48:01 +00:00
obcat
0cbe0f392d Prevent hunk preview using preview window from changing alternate file 2021-02-06 11:37:12 +09:00
obcat
987a33355e Show message like "Hunk 4 of 11" after hunk jumping 2020-11-05 16:43:52 +00:00
Andy Stewart
62ff20f979 Return early when pre-condition not met 2020-07-28 10:16:47 +01:00
Andy Stewart
63941de9f9 Distinguish no hunks at all from no further hunks
Closes #709.
2020-07-28 10:12:48 +01:00
Andy Stewart
51a03d4ae0 Add option for <Esc> to close non-floating preview window
Closes #718.
2020-06-23 15:18:25 +01:00
Andy Stewart
97a24e903a Reset any existing preview window
When previewing a hunk we re-use any existing preview window.  However
we need to reset it for our purposes in case it was used in an
incompatible way before.

See #713.
2020-06-18 09:38:43 +01:00
Andy Stewart
e31e9bb35f Avoid E315 when populating Neovim floating preview window
Fixes #711.
2020-06-10 09:13:35 +01:00
Andy Stewart
9784226ba7 Account for wrapping when resizing preview window
Fixes #708.
2020-05-29 10:46:42 +01:00
Andy Stewart
425c7cf2e2 Maintain backward compatibility in hunk preview code
win_getid() was introduced in Vim 7.4.1557.  The code uses it to
remember the id of the preview window.  In newer Vims or Neovim this
could be a floating window but pre-7.4.1557 it can only be an ordinary
preview window.  And in that case we only need the preview window's
buffer number.

This commit uses the buffer number when win_getid() isn't available.

Fixes #683.
2020-04-23 09:28:38 +01:00
Andy Stewart
3599736179 Fire GitGutterStage User event after staging
Closes #698.
2020-04-23 08:59:26 +01:00
qlem
9cdb90b1e1 fix #688 2020-04-01 17:33:05 +01:00
qlem
262f1b5c9a keep noautocmd and fire WinEnter with a doautocmd 2020-04-01 13:07:03 +01:00
qlem
9c7f819538 fix the behavior of the status line of the hunk preview windows 2020-04-01 13:07:03 +01:00
Andy Stewart
c337eef1b7 Make hunk commands noops when file not tracked by git
Fixes #680.
2020-02-24 15:42:05 +00:00
Andy Stewart
320b7a33e7 Fix preview and undo hunk for dos line endings 2019-10-14 10:10:46 +01:00
Andy Stewart
b94fab3070 Use matchaddpos() instead of text properties
matchaddpos() has better backward compatibility than text properties.  I
only used text properties inside Vim popups because I did not think
there was a way to use matchaddpos(), but then I found a way.
2019-09-26 15:08:56 +01:00
Andy Stewart
677a80c4ed Only show intra line highlights in Vim popups when supported 2019-09-24 11:25:48 +01:00
Andy Stewart
dfa6972b67 Add intra-line change highlighting for Vim popups 2019-09-24 11:07:29 +01:00
Andy Stewart
f980fab55c Do not enable syntax in Vim floating popup
Fixes #653
Closes #654
2019-09-23 10:33:17 +01:00
Andy Stewart
fdecc23368 Hunk previews highlight intra-line changes.
Closes #577.
2019-09-18 11:55:01 +01:00
Andy Stewart
0469b8435a Deprecate <Plug>... maps in favour of <Plug>(...) 2019-09-04 08:56:36 +01:00
Andy Stewart
43c82ce8fb Whitespace. 2019-09-03 13:53:52 +01:00
Andy Stewart
0804623cb7 Reset hunk previewing window's modified state. 2019-09-03 13:52:55 +01:00
Andy Stewart
558e51bd5c Avoid duplicate autocommands in previewing window. 2019-09-02 10:40:25 +01:00
Andy Stewart
c375aea57a Enable any write in hunk previewing window to stage. 2019-08-29 15:45:27 +01:00
Andy Stewart
8bafd08ef4 Support diffs relative to the working tree.
Closes #558.
2019-08-28 09:22:06 +01:00
Andy Stewart
afb8e03222 Do not run ex commands unnecessarily via normal mode. 2019-08-27 19:49:49 +01:00
Andy Stewart
67c8cca890 Support Vim's popup windows for hunk previews.
Note this prevents staging partial hunks via the previw window.
2019-08-27 16:56:30 +01:00
Andy Stewart
f0f56b9569 Use floating windows for hunk previews on Neovim. 2019-08-27 16:02:51 +01:00
Andy Stewart
0c3e7219b4 Extract operations on hunk preview window. 2019-08-27 11:52:50 +01:00
Andy Stewart
77fb3fd81e Enable :w in preview window to stage the hunk. 2019-08-21 10:27:23 +01:00
Andy Stewart
53996f5cd1 Use simpler syntax for zero-width positive lookbehind. 2019-08-15 11:58:14 +01:00
Andy Stewart
b036fcf527 Stage part of any hunk.
See #279.
2019-08-13 15:57:22 +01:00
Andy Stewart
a5ee9f2f11 Rename variables for clarity. 2019-08-13 15:47:34 +01:00
Andy Stewart
c9fd335246 Add comments. 2019-08-13 15:45:51 +01:00
Andy Stewart
773a5697f1 Warn user when git rejects patch. 2019-08-13 15:45:29 +01:00
Andy Stewart
50a7a9f6cb Ensure no extra blank line in hunk preview window.
Closes #640.
2019-08-13 13:06:58 +01:00
Andy Stewart
bc1d28db46 Allow staging part of an additions-only hunk.
See #279.
2019-08-12 17:19:05 +01:00
homestar
8985017094 Add g:gitgutter_preview_win_location option 2019-08-08 16:31:44 +01:00
Andy Stewart
5989eb882e Do not overwrite registers when undoing hunks.
Fixes #629.
2019-06-14 16:56:28 +01:00
Andy Stewart
dc3c0dcd2a Ensure git calls always use configured args for git.
See #628.
2019-06-14 12:52:13 +01:00
Daniel Hahler
8a4b9ccf52 Fix calls to repeat#set: remove trailing "<CR>" 2019-03-08 13:51:05 +00:00