summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0988
blob: 1f2dc29f9546eb503014b5ebd576dab6c130fbc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0988
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0988
Problem:    Deleting a location list buffer breaks location list window
            functionality.
Solution:   (Yegappan Lakshmanan, closes #4056)
Files:	    src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-8.1.0987/src/quickfix.c	2019-02-10 22:58:58.976414779 +0100
--- src/quickfix.c	2019-03-02 07:55:18.877241143 +0100
***************
*** 3981,3986 ****
--- 3981,4007 ----
  }
  
  /*
+  * Set options for the buffer in the quickfix or location list window.
+  */
+     static void
+ qf_set_cwindow_options(void)
+ {
+     // switch off 'swapfile'
+     set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
+     set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
+ 	    OPT_LOCAL);
+     set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
+     RESET_BINDING(curwin);
+ #ifdef FEAT_DIFF
+     curwin->w_p_diff = FALSE;
+ #endif
+ #ifdef FEAT_FOLDING
+     set_option_value((char_u *)"fdm", 0L, (char_u *)"manual",
+ 	    OPT_LOCAL);
+ #endif
+ }
+ 
+ /*
   * Open a new quickfix or location list window, load the quickfix buffer and
   * set the appropriate options for the window.
   * Returns FAIL if the window could not be opened.
***************
*** 4032,4054 ****
  	// Create a new quickfix buffer
  	(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin);
  
- 	// switch off 'swapfile'
- 	set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
- 	set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
- 		OPT_LOCAL);
- 	set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
- 	RESET_BINDING(curwin);
- #ifdef FEAT_DIFF
- 	curwin->w_p_diff = FALSE;
- #endif
- #ifdef FEAT_FOLDING
- 	set_option_value((char_u *)"fdm", 0L, (char_u *)"manual",
- 		OPT_LOCAL);
- #endif
  	// save the number of the new buffer
  	qi->qf_bufnr = curbuf->b_fnum;
      }
  
      // Only set the height when still in the same tab page and there is no
      // window to the side.
      if (curtab == prevtab && curwin->w_width == Columns)
--- 4053,4068 ----
  	// Create a new quickfix buffer
  	(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin);
  
  	// save the number of the new buffer
  	qi->qf_bufnr = curbuf->b_fnum;
      }
  
+     // Set the options for the quickfix buffer/window (if not already done)
+     // Do this even if the quickfix buffer was already present, as an autocmd
+     // might have previously deleted (:bdelete) the quickfix buffer.
+     if (curbuf->b_p_bt[0] != 'q')
+ 	qf_set_cwindow_options();
+ 
      // Only set the height when still in the same tab page and there is no
      // window to the side.
      if (curtab == prevtab && curwin->w_width == Columns)
*** ../vim-8.1.0987/src/testdir/test_quickfix.vim	2019-02-10 22:58:58.976414779 +0100
--- src/testdir/test_quickfix.vim	2019-03-02 07:55:18.877241143 +0100
***************
*** 3933,3938 ****
--- 3933,3948 ----
      call assert_match(qfbnum . '  h-  "\[Location List]"', execute('ls'))
      call assert_true(bufloaded(qfbnum))
  
+     " After deleting a location list buffer using ":bdelete", opening the
+     " location list window should mark the buffer as a location list buffer.
+     exe "bdelete " . qfbnum
+     lopen
+     call assert_equal("quickfix", &buftype)
+     call assert_equal(1, getwininfo(win_getid(winnr()))[0].loclist)
+     call assert_equal(wid, getloclist(0, {'filewinid' : 0}).filewinid)
+     call assert_false(&swapfile)
+     lclose
+ 
      " When the location list is cleared for the window, the buffer should be
      " removed
      call setloclist(0, [], 'f')
*** ../vim-8.1.0987/src/version.c	2019-03-02 07:15:20.217458790 +0100
--- src/version.c	2019-03-02 07:56:37.372654522 +0100
***************
*** 781,782 ****
--- 781,784 ----
  {   /* Add new patch number below this line */
+ /**/
+     988,
  /**/

-- 
What a wonderfully exciting cough!  Do you mind if I join you?
		-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///