Compare commits

...

5 Commits

Author SHA1 Message Date
Bram Moolenaar
2cec027af4 patch 8.2.2641: display test fails because of lacking redraw
Problem:    Display test fails because of lacking redraw.
Solution:   Add a redraw command.
2021-03-22 17:30:47 +01:00
Bram Moolenaar
f1387285e2 patch 8.2.2640: screenstring() returns non-existing composing characters
Problem:    screenstring() returns non-existing composing characters.
Solution:   Only use composing characters if there is a base character.
2021-03-22 17:11:15 +01:00
Bram Moolenaar
5ea79a2599 patch 8.2.2639: build failure when fsync() is not available
Problem:    Build failure when fsync() is not available.
Solution:   Add #ifdef.
2021-03-22 16:45:35 +01:00
Bram Moolenaar
4c86830fc5 patch 8.2.2638: cannot write a message to the terminal from the GUI
Problem:    Cannot write a message to the terminal from the GUI.
Solution:   Add :echoconsole and use it in the test runner. (issue #7975)
2021-03-22 16:19:45 +01:00
Bram Moolenaar
09f8b3a022 patch 8.2.2637: prop_remove() causes a redraw even when nothing changed
Problem:    prop_remove() causes a redraw even when nothing changed.
Solution:   Only redraw if a property was removed.
2021-03-21 22:29:54 +01:00
13 changed files with 75 additions and 45 deletions

View File

@@ -13141,7 +13141,12 @@ text...
< If you just want a highlighted message use |:echohl|.
And to get a beep: >
:exe "normal \<Esc>"
<
:echoc[onsole] {expr1} .. *:echoc* *:echoconsole*
Intended for testing: works like `:echomsg` but when
running in the GUI and started from a terminal write
the text to stdout.
*:eval*
:eval {expr} Evaluate {expr} and discard the result. Example: >
:eval Getlist()->Filter()->append('$')

View File

@@ -6117,6 +6117,7 @@ get_echo_attr(void)
* ":execute expr1 ..." execute the result of an expression.
* ":echomsg expr1 ..." Print a message
* ":echoerr expr1 ..." Print an error
* ":echoconsole expr1 ..." Print a message on stdout
* Each gets spaces around each argument and a newline at the end for
* echo commands
*/
@@ -6194,6 +6195,11 @@ ex_execute(exarg_T *eap)
msg_attr(ga.ga_data, echo_attr);
out_flush();
}
else if (eap->cmdidx == CMD_echoconsole)
{
ui_write(ga.ga_data, (int)STRLEN(ga.ga_data), TRUE);
ui_write((char_u *)"\r\n", 2, TRUE);
}
else if (eap->cmdidx == CMD_echoerr)
{
int save_did_emsg = did_emsg;

View File

@@ -7902,7 +7902,7 @@ f_screenstring(typval_T *argvars, typval_T *rettv)
c = ScreenLines[off];
buflen += mb_char2bytes(c, buf);
if (enc_utf8)
if (enc_utf8 && ScreenLinesUC[off] != 0)
for (i = 0; i < Screen_mco && ScreenLinesC[i][off] != 0; ++i)
buflen += mb_char2bytes(ScreenLinesC[i][off], buf + buflen);

View File

@@ -10,27 +10,27 @@ static const unsigned short cmdidxs1[26] =
/* c */ 43,
/* d */ 109,
/* e */ 134,
/* f */ 157,
/* g */ 174,
/* h */ 180,
/* i */ 189,
/* j */ 208,
/* k */ 210,
/* l */ 215,
/* m */ 277,
/* n */ 295,
/* o */ 315,
/* p */ 327,
/* q */ 366,
/* r */ 369,
/* s */ 389,
/* t */ 458,
/* u */ 503,
/* v */ 514,
/* w */ 535,
/* x */ 549,
/* y */ 559,
/* z */ 560
/* f */ 158,
/* g */ 175,
/* h */ 181,
/* i */ 190,
/* j */ 209,
/* k */ 211,
/* l */ 216,
/* m */ 278,
/* n */ 296,
/* o */ 316,
/* p */ 328,
/* q */ 367,
/* r */ 370,
/* s */ 390,
/* t */ 459,
/* u */ 504,
/* v */ 515,
/* w */ 536,
/* x */ 550,
/* y */ 560,
/* z */ 561
};
/*
@@ -45,7 +45,7 @@ static const unsigned char cmdidxs2[26][26] =
/* b */ { 2, 0, 0, 5, 6, 8, 0, 0, 0, 0, 0, 9, 10, 11, 12, 13, 0, 14, 0, 0, 0, 0, 23, 0, 0, 0 },
/* c */ { 3, 12, 16, 18, 20, 22, 25, 0, 0, 0, 0, 33, 37, 40, 46, 56, 58, 59, 60, 0, 62, 0, 65, 0, 0, 0 },
/* d */ { 0, 0, 0, 0, 0, 0, 0, 0, 8, 18, 0, 19, 0, 0, 20, 0, 0, 22, 23, 0, 0, 0, 0, 0, 0, 0 },
/* e */ { 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 10, 0, 0, 0, 0, 0, 0, 0, 17, 0, 18, 0, 0 },
/* e */ { 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 8, 10, 11, 0, 0, 0, 0, 0, 0, 0, 18, 0, 19, 0, 0 },
/* f */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0 },
/* g */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 4, 5, 0, 0, 0, 0 },
/* h */ { 5, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -69,4 +69,4 @@ static const unsigned char cmdidxs2[26][26] =
/* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
static const int command_count = 575;
static const int command_count = 576;

View File

@@ -530,6 +530,9 @@ EXCMD(CMD_echohl, "echohl", ex_echohl,
EXCMD(CMD_echomsg, "echomsg", ex_execute,
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
ADDR_NONE),
EXCMD(CMD_echoconsole, "echoconsole", ex_execute,
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
ADDR_NONE),
EXCMD(CMD_echon, "echon", ex_echo,
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
ADDR_NONE),

View File

@@ -1,11 +1,11 @@
/* ui.c */
void ui_write(char_u *s, int len);
void ui_write(char_u *s, int len, int console);
void ui_inchar_undo(char_u *s, int len);
int ui_inchar(char_u *buf, int maxlen, long wtime, int tb_change_cnt);
int inchar_loop(char_u *buf, int maxlen, long wtime, int tb_change_cnt, int (*wait_func)(long wtime, int *interrupted, int ignore_input), int (*resize_func)(int check_only));
int ui_wait_for_chars_or_timer(long wtime, int (*wait_func)(long wtime, int *interrupted, int ignore_input), int *interrupted, int ignore_input);
int ui_char_avail(void);
void ui_delay(long msec, int ignoreinput);
void ui_delay(long msec_arg, int ignoreinput);
void ui_suspend(void);
void suspend_shell(void);
int ui_get_shellsize(void);

View File

@@ -2545,7 +2545,7 @@ out_flush(void)
// set out_pos to 0 before ui_write, to avoid recursiveness
len = out_pos;
out_pos = 0;
ui_write(out_buf, len);
ui_write(out_buf, len, FALSE);
#ifdef FEAT_JOB_CHANNEL
if (ch_log_output)
{

View File

@@ -162,7 +162,7 @@ function GetAllocId(name)
endfunc
func RunTheTest(test)
echo 'Executing ' . a:test
echoconsole 'Executing ' . a:test
if has('reltime')
let func_start = reltime()
endif

View File

@@ -268,12 +268,13 @@ func Test_eob_fillchars()
call assert_fails(':set fillchars=eob:<ff>', 'E474:')
" default is ~
new
redraw
call assert_equal('~', Screenline(2))
set fillchars=eob:+
redraw!
redraw
call assert_equal('+', Screenline(2))
set fillchars=eob:\
redraw!
redraw
call assert_equal(' ', nr2char(screenchar(2, 1)))
set fillchars&
close

View File

@@ -146,7 +146,7 @@ func Test_listchars()
set list
" Non-breaking space
let nbsp = nr2char(0xa0)
call append(0, [ ">".nbsp."<" ])
call append(0, [ ">" .. nbsp .. "<" ])
let expected = '>X< '
@@ -193,12 +193,8 @@ func Test_listchars_unicode()
set list
let nbsp = nr2char(0xa0)
call append(0, [
\ "a\tb c".nbsp."d"
\ ])
let expected = [
\ 'a←↔↔↔↔↔→b␣c≠d⇔'
\ ]
call append(0, ["a\tb c" .. nbsp .. "d"])
let expected = ['a←↔↔↔↔↔→b␣c≠d⇔']
redraw!
call cursor(1, 1)
call assert_equal(expected, ScreenLines(1, virtcol('$')))
@@ -221,10 +217,10 @@ func Test_listchars_composing()
let nbsp1 = nr2char(0xa0)
let nbsp2 = nr2char(0x202f)
call append(0, [
\ " \u3099\t \u309A".nbsp1.nbsp1."\u0302".nbsp2.nbsp2."\u0302",
\ " \u3099\t \u309A" .. nbsp1 .. nbsp1 .. "\u0302" .. nbsp2 .. nbsp2 .. "\u0302",
\ ])
let expected = [
\ "_ \u3099^I \u309A=".nbsp1."\u0302=".nbsp2."\u0302$"
\ "_ \u3099^I \u309A=" .. nbsp1 .. "\u0302=" .. nbsp2 .. "\u0302$"
\ ]
redraw!
call cursor(1, 1)

View File

@@ -920,7 +920,8 @@ f_prop_remove(typval_T *argvars, typval_T *rettv)
}
}
}
redraw_buf_later(buf, NOT_VALID);
if (rettv->vval.v_number > 0)
redraw_buf_later(buf, NOT_VALID);
}
/*

View File

@@ -18,10 +18,14 @@
#include "vim.h"
void
ui_write(char_u *s, int len)
ui_write(char_u *s, int len, int console UNUSED)
{
#ifdef FEAT_GUI
if (gui.in_use && !gui.dying && !gui.starting)
if (gui.in_use && !gui.dying && !gui.starting
# ifndef NO_CONSOLE
&& !console
# endif
)
{
gui_write(s, len);
if (p_wd)
@@ -33,7 +37,7 @@ ui_write(char_u *s, int len)
// Don't output anything in silent mode ("ex -s") unless 'verbose' set
if (!(silent_mode && p_verbose == 0))
{
#if !defined(MSWIN)
# if !defined(MSWIN)
char_u *tofree = NULL;
if (output_conv.vc_type != CONV_NONE)
@@ -43,9 +47,13 @@ ui_write(char_u *s, int len)
if (tofree != NULL)
s = tofree;
}
#endif
# endif
mch_write(s, len);
# if defined(HAVE_FSYNC)
if (console && s[len - 1] == '\n')
vim_fsync(1);
# endif
# if !defined(MSWIN)
if (output_conv.vc_type != CONV_NONE)

View File

@@ -750,6 +750,16 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2641,
/**/
2640,
/**/
2639,
/**/
2638,
/**/
2637,
/**/
2636,
/**/