From 4f8da80fec79b8d229bfb75d5825b65a3f4bea61 Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Sun, 24 Jul 2011 16:22:17 -0400 Subject: [PATCH] Use SPACE as delimiter when joining multiple lines. Currently, when users use ctrl+mouse to select and copy multiple lines, those lines are joined into single line in a seamless way. LINEBREAK is simply removed, thus the first character of second line will be positioned right after the last character of the first line. This patch replaces the LINEBREAK with a SPACE. Thanks to Jekyll Wu (adaptee@gmail.com) for patch and research. BUG: 136730 FIXED-IN: 4.8 --- src/Screen.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Screen.cpp b/src/Screen.cpp index cedad2dc..ecd1642b 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -1291,9 +1291,12 @@ int Screen::copyLineToStream(int line , const bool omitLineBreak = (currentLineProperties & LINE_WRAPPED) || !preserveLineBreaks; - if ( !omitLineBreak && appendNewLine && (count+1 < MAX_CHARS) ) + if ( appendNewLine && (count+1 < MAX_CHARS) ) { - characterBuffer[count] = Character('\n'); + // When users ask to omit the linebreaks, they usually mean: `treat + // LINEBREAK as SPACE , thus joining multiple lines into single line in + // the same way as 'J' does in VIM.` + characterBuffer[count] = omitLineBreak ? Character(' ') : Character('\n'); count++; }