did_wait_return = FALSE;
while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL)
{
+#ifdef HAS_MESSAGE_WINDOW
+ // For echowindow, use full width; for regular messages, leave last column
+ int wrap_col = msg_win != NULL ? cmdline_width : cmdline_width - 1;
+#else
+ int wrap_col = cmdline_width - 1;
+#endif
+
/*
* We are at the end of the screen line when:
* - When outputting a newline.
|| (has_mbyte && (*mb_ptr2cells)(s) > 1 && msg_col <= 2))
:
#endif
- ((*s != '\r' && msg_col + t_col >= cmdline_width - 1)
+ ((*s != '\r' && msg_col + t_col >= wrap_col)
|| (*s == TAB && msg_col + t_col
- >= ((cmdline_width - 1) & ~7))
+ >= (wrap_col & ~7))
|| (has_mbyte && (*mb_ptr2cells)(s) > 1
- && msg_col + t_col >= cmdline_width - 2)))))
+ && msg_col + t_col >= wrap_col - 1)))))
{
/*
* The screen is scrolled up when at the last row (some terminals
if (msg_win != NULL)
{
put_msg_win(msg_win, where, t_s, s, lnum);
+ if (where == PUT_BELOW)
+ ++lnum;
t_col = 0;
where = PUT_BELOW;
}
// Scroll the screen up one line.
msg_scroll_up();
- msg_row = Rows - 2;
- if (msg_col >= cmdline_width) // can happen after screen resize
- msg_col = cmdline_width - 1;
+#ifdef HAS_MESSAGE_WINDOW
+ if (msg_win == NULL)
+ {
+#endif
+ msg_row = Rows - 2;
+ if (msg_col >= cmdline_width) // can happen after screen resize
+ msg_col = cmdline_width - 1;
+#ifdef HAS_MESSAGE_WINDOW
+ }
+#endif
// Display char in last column before showing more-prompt.
if (*s >= ' '
}
wrap = *s == '\n'
- || msg_col + t_col >= cmdline_width
+ || msg_col + t_col >= wrap_col
|| (has_mbyte && (*mb_ptr2cells)(s) > 1
- && msg_col + t_col >= cmdline_width - 1);
+ && msg_col + t_col >= wrap_col - 1);
if (t_col > 0 && (wrap || *s == '\r' || *s == '\b'
|| *s == '\t' || *s == BELL))
{
if (msg_win != NULL)
{
put_msg_win(msg_win, where, t_s, s, lnum);
+ if (where == PUT_BELOW)
+ ++lnum;
t_col = 0;
where = PUT_BELOW;
+ // Reset msg_col after outputting to new line in echowindow
+ if (wrap)
+ msg_col = 0;
}
else
#endif
put_msg_win(msg_win, PUT_BELOW, t_s, t_s, lnum);
++lnum;
}
+ msg_col = 0; // Reset column for new line
}
else
#endif
# ifdef FEAT_RIGHTLEFT
cmdmsg_rl ||
# endif
- (cw > 1 && msg_col + t_col >= cmdline_width - 1))
+ (cw > 1 && msg_col + t_col >= wrap_col))
{
if (l > 1)
s = screen_puts_mbyte(s, l, attr) - 1;
call term_sendkeys(buf, ":call HideWin()\<CR>")
call VerifyScreenDump(buf, 'Test_echowindow_9', {})
+ call term_sendkeys(buf, ":set cmdheight=2 columns=50\<CR>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, ":echowindow 'S' .. repeat('a', &columns - 2) .. 'Eabcde'\<CR>")
+ call VerifyScreenDump(buf, 'Test_echowindow_10', {})
+ call term_sendkeys(buf, "\<ESC>")
+ call TermWait(buf, 50)
+
+ call term_sendkeys(buf, ":echowindow 'A' .. repeat('0', &columns - 2) .. 'a' .. 'B' .. repeat('a', &columns - 2) .. 'b' .. 'C' .. repeat('a', &columns - 2) .. 'c' .. 'D' .. repeat('a', &columns - 2) .. 'd12345'")
+ call term_sendkeys(buf, "\<CR>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, "\<CR>")
+ call VerifyScreenDump(buf, 'Test_echowindow_11', {})
+
" clean up
call StopVimInTerminal(buf)
endfunc