Merge pull request #10457 from bfredl/dwfloat
compositor: handle float overlapping left half of doublewidth char
This commit is contained in:
commit
0da7b67ef9
|
@ -290,10 +290,14 @@ static void compose_line(Integer row, Integer startcol, Integer endcol,
|
|||
{
|
||||
// in case we start on the right half of a double-width char, we need to
|
||||
// check the left half. But skip it in output if it wasn't doublewidth.
|
||||
int skip = 0;
|
||||
int skipstart = 0, skipend = 0;
|
||||
if (startcol > 0 && (flags & kLineFlagInvalid)) {
|
||||
startcol--;
|
||||
skip = 1;
|
||||
skipstart = 1;
|
||||
}
|
||||
if (endcol < default_grid.Columns && (flags & kLineFlagInvalid)) {
|
||||
endcol++;
|
||||
skipend = 1;
|
||||
}
|
||||
|
||||
int col = (int)startcol;
|
||||
|
@ -345,20 +349,27 @@ static void compose_line(Integer row, Integer startcol, Integer endcol,
|
|||
if (linebuf[col-startcol][0] == NUL) {
|
||||
linebuf[col-startcol][0] = ' ';
|
||||
linebuf[col-startcol][1] = NUL;
|
||||
if (col == endcol-1) {
|
||||
skipend = 0;
|
||||
}
|
||||
} else if (n > 1 && linebuf[col-startcol+1][0] == NUL) {
|
||||
skip = 0;
|
||||
skipstart = 0;
|
||||
}
|
||||
if (grid->comp_col+grid->Columns > until
|
||||
&& grid->chars[off+n][0] == NUL) {
|
||||
linebuf[until-1-startcol][0] = ' ';
|
||||
linebuf[until-1-startcol][1] = '\0';
|
||||
if (col == startcol && n == 1) {
|
||||
skip = 0;
|
||||
skipstart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
col = until;
|
||||
}
|
||||
if (linebuf[endcol-startcol-1][0] == NUL) {
|
||||
skipend = 0;
|
||||
}
|
||||
|
||||
assert(endcol <= chk_width);
|
||||
assert(row < chk_height);
|
||||
|
||||
|
@ -368,9 +379,10 @@ static void compose_line(Integer row, Integer startcol, Integer endcol,
|
|||
flags = flags & ~kLineFlagWrap;
|
||||
}
|
||||
|
||||
ui_composed_call_raw_line(1, row, startcol+skip, endcol, endcol, 0, flags,
|
||||
(const schar_T *)linebuf+skip,
|
||||
(const sattr_T *)attrbuf+skip);
|
||||
ui_composed_call_raw_line(1, row, startcol+skipstart,
|
||||
endcol-skipend, endcol-skipend, 0, flags,
|
||||
(const schar_T *)linebuf+skipstart,
|
||||
(const sattr_T *)attrbuf+skipstart);
|
||||
}
|
||||
|
||||
static void compose_area(Integer startrow, Integer endrow,
|
||||
|
|
|
@ -4473,6 +4473,78 @@ describe('floating windows', function()
|
|||
]])
|
||||
end
|
||||
end)
|
||||
|
||||
it('can overlap doublewidth chars', function()
|
||||
insert([[
|
||||
# TODO: 测试字典信息的准确性
|
||||
# FIXME: 测试字典信息的准确性]])
|
||||
local buf = meths.create_buf(false,false)
|
||||
local win = meths.open_win(buf, false, {relative='editor', width=5, height=3, row=0, col=11, style='minimal'})
|
||||
if multigrid then
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:----------------------------------------]|
|
||||
[2:----------------------------------------]|
|
||||
[2:----------------------------------------]|
|
||||
[2:----------------------------------------]|
|
||||
[2:----------------------------------------]|
|
||||
[2:----------------------------------------]|
|
||||
|
|
||||
## grid 2
|
||||
# TODO: 测试字典信息的准确性 |
|
||||
# FIXME: 测试字典信息的准确^性 |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
## grid 3
|
||||
{1: }|
|
||||
{1: }|
|
||||
{1: }|
|
||||
]], float_pos={ [3] = { { id = 1001 }, "NW", 1, 0, 11, true } }}
|
||||
else
|
||||
screen:expect([[
|
||||
# TODO: 测 {1: }信息的准确性 |
|
||||
# FIXME: 测{1: } 信息的准确^性 |
|
||||
{0:~ }{1: }{0: }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
end
|
||||
|
||||
meths.win_close(win, false)
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
## grid 1
|
||||
[2:----------------------------------------]|
|
||||
[2:----------------------------------------]|
|
||||
[2:----------------------------------------]|
|
||||
[2:----------------------------------------]|
|
||||
[2:----------------------------------------]|
|
||||
[2:----------------------------------------]|
|
||||
|
|
||||
## grid 2
|
||||
# TODO: 测试字典信息的准确性 |
|
||||
# FIXME: 测试字典信息的准确^性 |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
]])
|
||||
else
|
||||
screen:expect([[
|
||||
# TODO: 测试字典信息的准确性 |
|
||||
# FIXME: 测试字典信息的准确^性 |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
describe('with ext_multigrid', function()
|
||||
|
|
Loading…
Reference in New Issue