aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ui_bridge.c
diff options
context:
space:
mode:
authorRicky Zhou <ricky@rzhou.org>2018-08-25 15:07:52 -0700
committerRicky Zhou <ricky@rzhou.org>2018-09-03 03:25:02 -0700
commit8fd3725cc8d54bced0a8fe1474986d93e9ef0b5b (patch)
tree30370753fb95186f9259db5809bff30f13453634 /src/nvim/ui_bridge.c
parent7ff63fcdc0ba1ce2b8500641f3742d5ada68d496 (diff)
downloadrneovim-8fd3725cc8d54bced0a8fe1474986d93e9ef0b5b.tar.gz
rneovim-8fd3725cc8d54bced0a8fe1474986d93e9ef0b5b.tar.bz2
rneovim-8fd3725cc8d54bced0a8fe1474986d93e9ef0b5b.zip
tui: Hint wrapped lines to terminals.
Previously, when neovim would wrap a line across multiple lines, terminal emulators could not detect that the lines represent a single wrapped line as opposed to several separate lines. As a result, many terminals' selection/copying functionality would treat a wrapped line as several newline-delimited lines. Fix this by reenabling a "special trick" from Vim. When a line is wrapped, write the last character of that line followed by the first character of the next line to the terminal. This hints to the terminal that the next line is a continuation of the current line. Extends the raw_line event with a "wrap" parameter which controls when to do wrap hinting.
Diffstat (limited to 'src/nvim/ui_bridge.c')
-rw-r--r--src/nvim/ui_bridge.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c
index a96a24bde7..ebd4651f4d 100644
--- a/src/nvim/ui_bridge.c
+++ b/src/nvim/ui_bridge.c
@@ -152,24 +152,24 @@ static void ui_bridge_raw_line_event(void **argv)
UI *ui = UI(argv[0]);
ui->raw_line(ui, PTR2INT(argv[1]), PTR2INT(argv[2]), PTR2INT(argv[3]),
PTR2INT(argv[4]), PTR2INT(argv[5]), PTR2INT(argv[6]),
- argv[7], argv[8]);
- xfree(argv[7]);
+ PTR2INT(argv[7]), argv[8], argv[9]);
xfree(argv[8]);
+ xfree(argv[9]);
}
static void ui_bridge_raw_line(UI *ui, Integer grid, Integer row,
Integer startcol, Integer endcol,
Integer clearcol, Integer clearattr,
- const schar_T *chunk, const sattr_T *attrs)
+ Boolean wrap, const schar_T *chunk,
+ const sattr_T *attrs)
{
size_t ncol = (size_t)(endcol-startcol);
schar_T *c = xmemdup(chunk, ncol * sizeof(schar_T));
sattr_T *hl = xmemdup(attrs, ncol * sizeof(sattr_T));
- UI_BRIDGE_CALL(ui, raw_line, 9, ui, INT2PTR(grid), INT2PTR(row),
+ UI_BRIDGE_CALL(ui, raw_line, 10, ui, INT2PTR(grid), INT2PTR(row),
INT2PTR(startcol), INT2PTR(endcol), INT2PTR(clearcol),
- INT2PTR(clearattr), c, hl);
+ INT2PTR(clearattr), INT2PTR(wrap), c, hl);
}
-
static void ui_bridge_suspend(UI *b)
{
UIBridgeData *data = (UIBridgeData *)b;