mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 11:18:19 +00:00
refactor(screen): let win_line() always handle fillers after last line
This commit is contained in:
@@ -21,6 +21,8 @@ typedef struct foldinfo {
|
|||||||
long fi_lines;
|
long fi_lines;
|
||||||
} foldinfo_T;
|
} foldinfo_T;
|
||||||
|
|
||||||
|
#define FOLDINFO_INIT { 0, 0, 0, 0 }
|
||||||
|
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "fold.h.generated.h"
|
# include "fold.h.generated.h"
|
||||||
|
@@ -1695,17 +1695,11 @@ static void win_update(win_T *wp, Providers *providers)
|
|||||||
wp->w_botline = buf->b_ml.ml_line_count + 1;
|
wp->w_botline = buf->b_ml.ml_line_count + 1;
|
||||||
j = diff_check_fill(wp, wp->w_botline);
|
j = diff_check_fill(wp, wp->w_botline);
|
||||||
if (j > 0 && !wp->w_botfill) {
|
if (j > 0 && !wp->w_botfill) {
|
||||||
// display filler lines at the end of the file
|
// Display filler text below last line. win_line() will check
|
||||||
if (char2cells(wp->w_p_fcs_chars.diff) > 1) {
|
// for ml_line_count+1 and only draw filler lines
|
||||||
i = '-';
|
foldinfo_T info = FOLDINFO_INIT;
|
||||||
} else {
|
row = win_line(wp, wp->w_botline, row, wp->w_grid.Rows,
|
||||||
i = wp->w_p_fcs_chars.diff;
|
false, false, info, &line_providers);
|
||||||
}
|
|
||||||
if (row + j > wp->w_grid.Rows) {
|
|
||||||
j = wp->w_grid.Rows - row;
|
|
||||||
}
|
|
||||||
win_draw_end(wp, i, i, true, row, row + (int)j, HLF_DED);
|
|
||||||
row += j;
|
|
||||||
}
|
}
|
||||||
} else if (dollar_vcol == -1) {
|
} else if (dollar_vcol == -1) {
|
||||||
wp->w_botline = lnum;
|
wp->w_botline = lnum;
|
||||||
@@ -2196,6 +2190,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
row = startrow;
|
row = startrow;
|
||||||
|
|
||||||
buf_T *buf = wp->w_buffer;
|
buf_T *buf = wp->w_buffer;
|
||||||
|
bool end_fill = (lnum == buf->b_ml.ml_line_count+1);
|
||||||
|
|
||||||
if (!number_only) {
|
if (!number_only) {
|
||||||
// To speed up the loop below, set extra_check when there is linebreak,
|
// To speed up the loop below, set extra_check when there is linebreak,
|
||||||
@@ -2263,6 +2258,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
|
|
||||||
if (wp->w_p_spell
|
if (wp->w_p_spell
|
||||||
&& !has_fold
|
&& !has_fold
|
||||||
|
&& !end_fill
|
||||||
&& *wp->w_s->b_p_spl != NUL
|
&& *wp->w_s->b_p_spl != NUL
|
||||||
&& !GA_EMPTY(&wp->w_s->b_langp)
|
&& !GA_EMPTY(&wp->w_s->b_langp)
|
||||||
&& *(char **)(wp->w_s->b_langp.ga_data) != NULL) {
|
&& *(char **)(wp->w_s->b_langp.ga_data) != NULL) {
|
||||||
@@ -2466,7 +2462,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
line_attr_lowprio_save = line_attr_lowprio;
|
line_attr_lowprio_save = line_attr_lowprio;
|
||||||
}
|
}
|
||||||
|
|
||||||
line = ml_get_buf(wp->w_buffer, lnum, false);
|
line = end_fill ? (char_u *)"" : ml_get_buf(wp->w_buffer, lnum, false);
|
||||||
ptr = line;
|
ptr = line;
|
||||||
|
|
||||||
if (has_spell && !number_only) {
|
if (has_spell && !number_only) {
|
||||||
@@ -2500,7 +2496,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp->w_p_list && !has_fold) {
|
if (wp->w_p_list && !has_fold && !end_fill) {
|
||||||
if (wp->w_p_lcs_chars.space
|
if (wp->w_p_lcs_chars.space
|
||||||
|| wp->w_p_lcs_chars.trail
|
|| wp->w_p_lcs_chars.trail
|
||||||
|| wp->w_p_lcs_chars.lead
|
|| wp->w_p_lcs_chars.lead
|
||||||
@@ -2656,7 +2652,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
cur = wp->w_match_head;
|
cur = wp->w_match_head;
|
||||||
shl_flag = false;
|
shl_flag = false;
|
||||||
while ((cur != NULL || !shl_flag) && !number_only
|
while ((cur != NULL || !shl_flag) && !number_only
|
||||||
&& !has_fold) {
|
&& !has_fold && !end_fill) {
|
||||||
if (!shl_flag) {
|
if (!shl_flag) {
|
||||||
shl = &search_hl;
|
shl = &search_hl;
|
||||||
shl_flag = true;
|
shl_flag = true;
|
||||||
@@ -4467,7 +4463,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
filler_todo--;
|
filler_todo--;
|
||||||
// When the filler lines are actually below the last line of the
|
// When the filler lines are actually below the last line of the
|
||||||
// file, don't draw the line itself, break here.
|
// file, don't draw the line itself, break here.
|
||||||
if (filler_todo == 0 && wp->w_botfill) {
|
if (filler_todo == 0 && (wp->w_botfill || end_fill)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user