Skip to content

Commit cf4d962

Browse files
h-eastchrisbra
authored andcommitted
patch 9.1.1898: tabpanel: inconsistent use of cmdline with tabpanel
Problem: tabpanel: inconsistent use of cmdline and message area with tabpanel Solution: Reduce the cmdline and message area by the horizontal size of the tabpanel (Hirohito Higashi) closes: #18678 Signed-off-by: Hirohito Higashi <h.east.727@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 24e4fa1 commit cf4d962

93 files changed

Lines changed: 270 additions & 231 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/arglist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ arg_all_close_unused_windows(arg_all_state_T *aall)
10071007
buf = wp->w_buffer;
10081008
if (buf->b_ffname == NULL
10091009
|| (!aall->keep_tabs && (buf->b_nwindows > 1
1010-
|| wp->w_width != Columns)))
1010+
|| wp->w_width != cmdline_width)))
10111011
i = aall->opened_len;
10121012
else
10131013
{

src/cmdexpand.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ cmdline_pum_create(
421421
if (showtail)
422422
prefix_len += vim_strsize(showmatches_gettail(matches[0]))
423423
- vim_strsize(matches[0]);
424-
compl_startcol = MAX(0, compl_startcol - prefix_len);
424+
compl_startcol = cmdline_col_off + MAX(0, compl_startcol - prefix_len);
425425

426426
return EXPAND_OK;
427427
}
@@ -611,9 +611,9 @@ win_redr_status_matches(
611611
return;
612612

613613
if (has_mbyte)
614-
buf = alloc(Columns * MB_MAXBYTES + 1);
614+
buf = alloc(topframe->fr_width * MB_MAXBYTES + 1);
615615
else
616-
buf = alloc(Columns + 1);
616+
buf = alloc(topframe->fr_width + 1);
617617
if (buf == NULL)
618618
return;
619619

@@ -640,15 +640,15 @@ win_redr_status_matches(
640640
if (first_match > 0)
641641
clen += 2;
642642
// jumping right, put match at the left
643-
if ((long)clen > Columns)
643+
if (clen > topframe->fr_width)
644644
{
645645
first_match = match;
646646
// if showing the last match, we can add some on the left
647647
clen = 2;
648648
for (i = match; i < num_matches; ++i)
649649
{
650650
clen += status_match_len(xp, SHOW_MATCH(i)) + 2;
651-
if ((long)clen >= Columns)
651+
if (clen >= topframe->fr_width)
652652
break;
653653
}
654654
if (i == num_matches)
@@ -659,7 +659,7 @@ win_redr_status_matches(
659659
while (first_match > 0)
660660
{
661661
clen += status_match_len(xp, SHOW_MATCH(first_match - 1)) + 2;
662-
if ((long)clen >= Columns)
662+
if (clen >= topframe->fr_width)
663663
break;
664664
--first_match;
665665
}
@@ -679,7 +679,7 @@ win_redr_status_matches(
679679
clen = len;
680680

681681
i = first_match;
682-
while ((long)(clen + status_match_len(xp, SHOW_MATCH(i)) + 2) < Columns)
682+
while (clen + status_match_len(xp, SHOW_MATCH(i)) + 2 < topframe->fr_width)
683683
{
684684
if (i == match)
685685
{
@@ -773,14 +773,17 @@ win_redr_status_matches(
773773
}
774774
}
775775

776-
screen_puts(buf, row, 0, attr);
776+
screen_puts(buf, row, firstwin->w_wincol, attr);
777777
if (selstart != NULL && highlight)
778778
{
779779
*selend = NUL;
780-
screen_puts(selstart, row, selstart_col, HL_ATTR(HLF_WM));
780+
screen_puts(selstart, row, firstwin->w_wincol + selstart_col,
781+
HL_ATTR(HLF_WM));
781782
}
782783

783-
screen_fill(row, row + 1, clen, (int)Columns, fillchar, fillchar, attr);
784+
screen_fill(row, row + 1, firstwin->w_wincol + clen,
785+
firstwin->w_wincol + topframe->fr_width,
786+
fillchar, fillchar, attr);
784787
}
785788

786789
win_redraw_last_status(topframe);
@@ -1371,7 +1374,7 @@ showmatches(expand_T *xp, int display_wildmenu, int display_list, int noselect)
13711374
{
13721375
// compute the number of columns and lines for the listing
13731376
maxlen += 2; // two spaces between file names
1374-
columns = ((int)Columns + 2) / maxlen;
1377+
columns = (cmdline_width + 2) / maxlen;
13751378
if (columns < 1)
13761379
columns = 1;
13771380
lines = (numMatches + columns - 1) / columns;
@@ -4503,9 +4506,6 @@ wildmenu_cleanup(cmdline_info_T *cclp UNUSED)
45034506
p_ls = save_p_ls;
45044507
p_wmh = save_p_wmh;
45054508
last_status(FALSE);
4506-
#if defined(FEAT_TABPANEL)
4507-
redraw_tabpanel = TRUE;
4508-
#endif
45094509
update_screen(UPD_VALID); // redraw the screen NOW
45104510
redrawcmd();
45114511
save_p_ls = -1;

src/digraph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ printdigraph(digr_T *dp, result_T *previous)
19721972
*previous = dp->result;
19731973
}
19741974
#endif
1975-
if (msg_col > Columns - list_width)
1975+
if (msg_col > cmdline_width - list_width)
19761976
msg_putchar('\n');
19771977
if (msg_col)
19781978
while (msg_col % list_width != 0)

src/drawscreen.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
502502
if (wp->w_buffer->b_p_ro)
503503
plen += vim_snprintf((char *)p + plen, MAXPATHL - plen, "%s", _("[RO]"));
504504

505-
this_ru_col = ru_col - (Columns - wp->w_width);
505+
this_ru_col = ru_col - (cmdline_width - wp->w_width);
506506
n = (wp->w_width + 1) / 2;
507507
if (this_ru_col < n)
508508
this_ru_col = n;
@@ -721,8 +721,8 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
721721
row = Rows - 1;
722722
fillchar = ' ';
723723
attr = 0;
724-
width = Columns;
725-
off = 0;
724+
off = cmdline_col_off;
725+
width = cmdline_width;
726726
}
727727

728728
// In list mode virtcol needs to be recomputed
@@ -755,7 +755,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
755755
if (wp->w_status_height == 0) // can't use last char of screen
756756
++n1;
757757

758-
this_ru_col = ru_col - (Columns - width);
758+
this_ru_col = ru_col - (cmdline_width - width);
759759
// Never use more than half the window/screen width, leave the other
760760
// half for the filename.
761761
n2 = (width + 1) / 2;
@@ -2609,7 +2609,7 @@ win_update(win_T *wp)
26092609
FALSE);
26102610
else
26112611
screen_char(LineOffset[k] + topframe->fr_width - 1, k,
2612-
Columns - 1);
2612+
cmdline_width - 1);
26132613
}
26142614
#endif
26152615

src/ex_cmds.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ do_bang(
12531253
msg_putchar('!');
12541254
msg_outtrans(newcmd);
12551255
msg_clr_eos();
1256-
windgoto(msg_row, msg_col);
1256+
windgoto(msg_row, cmdline_col_off + msg_col);
12571257

12581258
do_shell(newcmd, 0);
12591259
}
@@ -1404,7 +1404,7 @@ do_filter(
14041404
if (cmd_buf == NULL)
14051405
goto filterend;
14061406

1407-
windgoto((int)Rows - 1, 0);
1407+
windgoto((int)Rows - 1, cmdline_col_off);
14081408
cursor_on();
14091409

14101410
/*
@@ -1659,7 +1659,7 @@ do_shell(
16591659
// This windgoto is required for when the '\n' resulted in a "delete line
16601660
// 1" command to the terminal.
16611661
if (!swapping_screen())
1662-
windgoto(msg_row, msg_col);
1662+
windgoto(msg_row, cmdline_col_off + msg_col);
16631663
cursor_on();
16641664
(void)call_shell(cmd, SHELL_COOKED | flags);
16651665
did_check_timestamps = FALSE;
@@ -4694,7 +4694,7 @@ ex_substitute(exarg_T *eap)
46944694
msg_no_more = FALSE;
46954695
msg_scroll = i;
46964696
showruler(TRUE);
4697-
windgoto(msg_row, msg_col);
4697+
windgoto(msg_row, cmdline_col_off + msg_col);
46984698
RedrawingDisabled = save_RedrawingDisabled;
46994699

47004700
#ifdef USE_ON_FLY_SCROLL

src/ex_docmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6684,7 +6684,7 @@ ex_stop(exarg_T *eap)
66846684
if (!eap->forceit)
66856685
autowrite_all();
66866686
apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, FALSE, NULL);
6687-
windgoto((int)Rows - 1, 0);
6687+
windgoto((int)Rows - 1, cmdline_col_off);
66886688
out_char('\n');
66896689
out_flush();
66906690
stoptermcap();

src/ex_getln.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ cmdline_erase_chars(
11671167
{
11681168
#ifdef FEAT_RIGHTLEFT
11691169
if (cmdmsg_rl)
1170-
msg_col = Columns;
1170+
msg_col = cmdline_width;
11711171
else
11721172
#endif
11731173
msg_col = 0;
@@ -1375,8 +1375,8 @@ cmdline_left_right_mouse(int c, int *ignore_drag_release)
13751375
int i;
13761376

13771377
i = cmdline_charsize(ccline.cmdpos);
1378-
if (mouse_row <= cmdline_row + ccline.cmdspos / Columns
1379-
&& mouse_col < ccline.cmdspos % Columns + i)
1378+
if (mouse_row <= cmdline_row + ccline.cmdspos / cmdline_width
1379+
&& mouse_col < ccline.cmdspos % cmdline_width + i)
13801380
break;
13811381
if (has_mbyte)
13821382
{
@@ -2114,7 +2114,7 @@ getcmdline_int(
21142114
goto cmdline_changed;
21152115
if (!cmd_silent)
21162116
{
2117-
windgoto(msg_row, 0);
2117+
windgoto(msg_row, cmdline_col_off);
21182118
out_flush();
21192119
}
21202120
break;
@@ -2285,7 +2285,7 @@ getcmdline_int(
22852285
if (ccline.cmdpos >= ccline.cmdlen)
22862286
break;
22872287
i = cmdline_charsize(ccline.cmdpos);
2288-
if (KeyTyped && ccline.cmdspos + i >= Columns * Rows)
2288+
if (KeyTyped && ccline.cmdspos + i >= cmdline_width * Rows)
22892289
break;
22902290
ccline.cmdspos += i;
22912291
if (has_mbyte)
@@ -3010,8 +3010,8 @@ set_cmdspos_cursor(void)
30103010
set_cmdspos();
30113011
if (KeyTyped)
30123012
{
3013-
m = Columns * Rows;
3014-
if (m < 0) // overflow, Columns or Rows at weird value
3013+
m = cmdline_width * Rows;
3014+
if (m < 0) // overflow, cmdline_width or Rows at weird value
30153015
m = MAXCOL;
30163016
}
30173017
else
@@ -3043,7 +3043,7 @@ correct_cmdspos(int idx, int cells)
30433043
{
30443044
if ((*mb_ptr2len)(ccline.cmdbuff + idx) > 1
30453045
&& (*mb_ptr2cells)(ccline.cmdbuff + idx) > 1
3046-
&& ccline.cmdspos % Columns + cells > Columns)
3046+
&& ccline.cmdspos % cmdline_width + cells > cmdline_width)
30473047
ccline.cmdspos++;
30483048
}
30493049

@@ -3243,7 +3243,7 @@ getexmodeline(
32433243
}
32443244
}
32453245
msg_clr_eos();
3246-
windgoto(msg_row, msg_col);
3246+
windgoto(msg_row, cmdline_col_off + msg_col);
32473247
continue;
32483248
}
32493249

@@ -3316,7 +3316,7 @@ getexmodeline(
33163316
line_ga.ga_len += len;
33173317
escaped = FALSE;
33183318

3319-
windgoto(msg_row, msg_col);
3319+
windgoto(msg_row, cmdline_col_off + msg_col);
33203320
pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len;
33213321

33223322
// We are done when a NL is entered, but not when it comes after a
@@ -3432,8 +3432,8 @@ redrawcmd_preedit(void)
34323432
cmdpos += preedit_start_col;
34333433
}
34343434

3435-
msg_row = cmdline_row + (cmdspos / (int)Columns);
3436-
msg_col = cmdspos % (int)Columns;
3435+
msg_row = cmdline_row + (cmdspos / cmdline_width);
3436+
msg_col = cmdspos % cmdline_width;
34373437
if (msg_row >= Rows)
34383438
msg_row = Rows - 1;
34393439

@@ -3808,7 +3808,7 @@ put_on_cmdline(char_u *str, int len, int redraw)
38083808
msg_col -= i;
38093809
if (msg_col < 0)
38103810
{
3811-
msg_col += Columns;
3811+
msg_col += cmdline_width;
38123812
--msg_row;
38133813
}
38143814
}
@@ -3827,8 +3827,8 @@ put_on_cmdline(char_u *str, int len, int redraw)
38273827
}
38283828
if (KeyTyped)
38293829
{
3830-
m = Columns * Rows;
3831-
if (m < 0) // overflow, Columns or Rows at weird value
3830+
m = cmdline_width * Rows;
3831+
if (m < 0) // overflow, cmdline_width or Rows at weird value
38323832
m = MAXCOL;
38333833
}
38343834
else
@@ -4052,7 +4052,7 @@ redrawcmdprompt(void)
40524052
if (ccline.cmdprompt != NULL)
40534053
{
40544054
msg_puts_attr((char *)ccline.cmdprompt, ccline.cmdattr);
4055-
ccline.cmdindent = msg_col + (msg_row - cmdline_row) * Columns;
4055+
ccline.cmdindent = msg_col + (msg_row - cmdline_row) * cmdline_width;
40564056
// do the reverse of set_cmdspos()
40574057
if (ccline.cmdfirstc != NUL)
40584058
--ccline.cmdindent;
@@ -4076,7 +4076,7 @@ redrawcmd(void)
40764076
// when 'incsearch' is set there may be no command line while redrawing
40774077
if (ccline.cmdbuff == NULL)
40784078
{
4079-
windgoto(cmdline_row, 0);
4079+
windgoto(cmdline_row, cmdline_col_off);
40804080
msg_clr_eos();
40814081
return;
40824082
}
@@ -4131,21 +4131,21 @@ cursorcmd(void)
41314131
#ifdef FEAT_RIGHTLEFT
41324132
if (cmdmsg_rl)
41334133
{
4134-
msg_row = cmdline_row + (ccline.cmdspos / (int)(Columns - 1));
4135-
msg_col = (int)Columns - (ccline.cmdspos % (int)(Columns - 1)) - 1;
4134+
msg_row = cmdline_row + (ccline.cmdspos / (cmdline_width - 1));
4135+
msg_col = cmdline_width - (ccline.cmdspos % (cmdline_width - 1)) - 1;
41364136
if (msg_row <= 0)
41374137
msg_row = Rows - 1;
41384138
}
41394139
else
41404140
#endif
41414141
{
4142-
msg_row = cmdline_row + (ccline.cmdspos / (int)Columns);
4143-
msg_col = ccline.cmdspos % (int)Columns;
4142+
msg_row = cmdline_row + (ccline.cmdspos / cmdline_width);
4143+
msg_col = ccline.cmdspos % cmdline_width;
41444144
if (msg_row >= Rows)
41454145
msg_row = Rows - 1;
41464146
}
41474147

4148-
windgoto(msg_row, msg_col);
4148+
windgoto(msg_row, cmdline_col_off + msg_col);
41494149
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
41504150
if (p_imst == IM_ON_THE_SPOT)
41514151
redrawcmd_preedit();
@@ -4161,13 +4161,13 @@ gotocmdline(int clr)
41614161
msg_start();
41624162
#ifdef FEAT_RIGHTLEFT
41634163
if (cmdmsg_rl)
4164-
msg_col = Columns - 1;
4164+
msg_col = cmdline_width - 1;
41654165
else
41664166
#endif
41674167
msg_col = 0; // always start in column 0
41684168
if (clr) // clear the bottom line(s)
41694169
msg_clr_eos(); // will reset clear_cmdline
4170-
windgoto(cmdline_row, 0);
4170+
windgoto(cmdline_row, cmdline_col_off);
41714171
}
41724172

41734173
/*

src/getchar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2448,7 +2448,7 @@ getchar_common(typval_T *argvars, typval_T *rettv, int allow_number)
24482448
if (cursor_flag == 'h')
24492449
cursor_sleep();
24502450
else if (cursor_flag == 'm')
2451-
windgoto(msg_row, msg_col);
2451+
windgoto(msg_row, cmdline_col_off + msg_col);
24522452

24532453
++no_mapping;
24542454
++allow_keys;

src/globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ EXTERN int vgetc_char INIT(= 0);
146146
* update_screen().
147147
*/
148148
EXTERN int cmdline_row;
149+
EXTERN int cmdline_col_off;
150+
EXTERN int cmdline_width;
149151

150152
EXTERN int redraw_cmdline INIT(= FALSE); // cmdline must be redrawn
151153
EXTERN int redraw_mode INIT(= FALSE); // mode must be redrawn

0 commit comments

Comments
 (0)