[PATCH] Semantic Linefeeds

Yuriy Skalko yuriy.skalko at gmail.com
Thu Nov 3 12:09:55 UTC 2022


Here is an updated patch with Chinese punctuation marks. Also now 
linebreak is added after em-dash even without next space (for English).

Yuriy

-------------- next part --------------
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 4ce94415f7..7156d442bf 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1746,16 +1746,27 @@ void Paragraph::write(ostream & os, BufferParams const & bparams,
 			column = 0;
 			break;
 		case '.':
+		case '!':
+		case '?':
+		case ':':
+		case ';':
+		case ',':
 			flushString(os, write_buffer);
 			if (i + 1 < size() && d->text_[i + 1] == ' ') {
-				os << ".\n";
+				os << to_utf8(docstring(1, c)) << '\n';
 				column = 0;
 			} else
-				os << '.';
+				os << to_utf8(docstring(1, c));
+			break;
+		case 0x2014:  // — U+2014  EM DASH
+		case 0x3002:  // 。 U+3002  IDEOGRAPHIC FULL STOP
+		case 0xFF0C:  // , U+FF0C  FULLWIDTH COMMA
+			flushString(os, write_buffer);
+			os << to_utf8(docstring(1, c)) << '\n';
+			column = 0;
 			break;
 		default:
-			if ((column > 70 && c == ' ')
-			    || column > 79) {
+			if (column > 500) {
 				flushString(os, write_buffer);
 				os << '\n';
 				column = 0;


More information about the lyx-devel mailing list