shell: support bell

This commit is contained in:
Björn Linse
2018-02-07 10:23:19 +01:00
parent a6052c7307
commit 60ce7d9e0a
3 changed files with 12 additions and 5 deletions

View File

@@ -455,7 +455,7 @@ static void out_data_append_to_screen(char *output, size_t remaining,
{
char *p = output, *end = output + remaining;
while (p < end) {
if (*p == '\n' || *p == '\r' || *p == TAB) {
if (*p == '\n' || *p == '\r' || *p == TAB || *p == BELL) {
msg_putchar_attr((uint8_t)(*p), 0);
p++;
} else {

View File

@@ -4,6 +4,7 @@ local helpers = require('test.functional.helpers')(after_each)
local feed, command, clear = helpers.feed, helpers.command, helpers.clear
local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir
local feed_command = helpers.feed_command
local eq = helpers.eq
if helpers.pending_win32(pending) then return end
@@ -52,18 +53,21 @@ describe(':! command', function()
it('handles binary and multibyte data', function()
feed_command('!cat test/functional/fixtures/shell_data.txt')
screen.bell = false
screen:expect([[
{1:~ }|
{1:~ }|
{1:~ }|
:!cat test/functional/fixtures/shell_data.txt |
{2:^@^A^B^C^D^E^F^G^H} |
{2:^@^A^B^C^D^E^F^H} |
{2:^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_} |
ö 한글 {2:<a5><c3>} |
t {2:<ff>} |
|
{3:Press ENTER or type command to continue}^ |
]])
]], nil, nil, function()
eq(true, screen.bell)
end)
end)
end)

View File

@@ -104,13 +104,16 @@ describe("shell command :!", function()
]])
feed([[<CR>]])
-- Print BELL control code. #4338
screen.bell = false
feed([[:!printf '\x07\x07\x07\x07text'<CR>]])
screen:expect([[
~ |
:!printf '\x07\x07\x07\x07text' |
^G^G^G^Gtext |
text |
Press ENTER or type command to continue^ |
]])
]], nil, nil, function()
eq(true, screen.bell)
end)
feed([[<CR>]])
-- Print BS control code.
feed([[:echo system('printf ''\x08\n''')<CR>]])