forked from aniani/vim
patch 7.4.1997
Problem: Cannot easily scroll the quickfix window. Solution: Add ":cbottom".
This commit is contained in:
@@ -2807,6 +2807,41 @@ ex_copen(exarg_T *eap)
|
||||
update_topline(); /* scroll to show the line */
|
||||
}
|
||||
|
||||
/*
|
||||
* Move the cursor in the quickfix window to "lnum".
|
||||
*/
|
||||
static void
|
||||
qf_win_goto(win_T *win, linenr_T lnum)
|
||||
{
|
||||
win_T *old_curwin = curwin;
|
||||
|
||||
curwin = win;
|
||||
curbuf = win->w_buffer;
|
||||
curwin->w_cursor.lnum = lnum;
|
||||
curwin->w_cursor.col = 0;
|
||||
#ifdef FEAT_VIRTUALEDIT
|
||||
curwin->w_cursor.coladd = 0;
|
||||
#endif
|
||||
curwin->w_curswant = 0;
|
||||
update_topline(); /* scroll to show the line */
|
||||
redraw_later(VALID);
|
||||
curwin->w_redr_status = TRUE; /* update ruler */
|
||||
curwin = old_curwin;
|
||||
curbuf = curwin->w_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* :cbottom command.
|
||||
*/
|
||||
void
|
||||
ex_cbottom(exarg_T *eap UNUSED)
|
||||
{
|
||||
win_T *win = qf_find_win(&ql_info);
|
||||
|
||||
if (win != NULL && win->w_cursor.lnum != win->w_buffer->b_ml.ml_line_count)
|
||||
qf_win_goto(win, win->w_buffer->b_ml.ml_line_count);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the number of the current entry (line number in the quickfix
|
||||
* window).
|
||||
@@ -2844,27 +2879,17 @@ qf_win_pos_update(
|
||||
&& qf_index <= win->w_buffer->b_ml.ml_line_count
|
||||
&& old_qf_index != qf_index)
|
||||
{
|
||||
win_T *old_curwin = curwin;
|
||||
|
||||
curwin = win;
|
||||
curbuf = win->w_buffer;
|
||||
if (qf_index > old_qf_index)
|
||||
{
|
||||
curwin->w_redraw_top = old_qf_index;
|
||||
curwin->w_redraw_bot = qf_index;
|
||||
win->w_redraw_top = old_qf_index;
|
||||
win->w_redraw_bot = qf_index;
|
||||
}
|
||||
else
|
||||
{
|
||||
curwin->w_redraw_top = qf_index;
|
||||
curwin->w_redraw_bot = old_qf_index;
|
||||
win->w_redraw_top = qf_index;
|
||||
win->w_redraw_bot = old_qf_index;
|
||||
}
|
||||
curwin->w_cursor.lnum = qf_index;
|
||||
curwin->w_cursor.col = 0;
|
||||
update_topline(); /* scroll to show the line */
|
||||
redraw_later(VALID);
|
||||
curwin->w_redr_status = TRUE; /* update ruler */
|
||||
curwin = old_curwin;
|
||||
curbuf = curwin->w_buffer;
|
||||
qf_win_goto(win, qf_index);
|
||||
}
|
||||
return win != NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user