Add "semantic linefeeds" after punctuation marks.

We already had such breaks for dot.

File format change.
This commit is contained in:
Yuriy Skalko 2022-11-27 18:30:26 +02:00
parent ec767f02a0
commit 7b23c76b71
4 changed files with 32 additions and 8 deletions

View File

@ -7,6 +7,10 @@ changes happened in particular if possible. A good example would be
----------------------- -----------------------
2022-11-27 Yuriy Skalko <yuriy.skalko@gmail.com>
* Format incremented to 611: Implement "semantic linefeeds" after punctuation marks.
Dummy format change for now.
2022-10-29 Jürgen Spitzmüller <spitz@lyx.org> 2022-10-29 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 610: InsetIndexMacros and new IndexInset params: * Format incremented to 610: InsetIndexMacros and new IndexInset params:
- \begin_inset IndexMacro [see|seealso|subentry|sortkey], relating to - \begin_inset IndexMacro [see|seealso|subentry|sortkey], relating to

View File

@ -4621,10 +4621,12 @@ convert = [
[607, []], [607, []],
[608, []], [608, []],
[609, []], [609, []],
[610, []] [610, []],
[611, []]
] ]
revert = [[609, [revert_index_macros]], revert = [[610, []],
[609, [revert_index_macros]],
[608, [revert_document_metadata]], [608, [revert_document_metadata]],
[607, [revert_docbook_mathml_prefix]], [607, [revert_docbook_mathml_prefix]],
[606, [revert_spellchecker_ignore]], [606, [revert_spellchecker_ignore]],

View File

@ -1746,16 +1746,34 @@ void Paragraph::write(ostream & os, BufferParams const & bparams,
column = 0; column = 0;
break; break;
case '.': case '.':
case '!':
case '?':
case ':':
case ';':
case ',':
case 0x061F: // ؟ U+061F ARABIC QUESTION MARK
case 0x061B: // ؛ U+061B ARABIC SEMICOLON
case 0x060C: // ، U+060C ARABIC COMMA
flushString(os, write_buffer); flushString(os, write_buffer);
if (i + 1 < size() && d->text_[i + 1] == ' ') { if (i + 1 < size() && d->text_[i + 1] == ' ') {
os << ".\n"; os << to_utf8(docstring(1, c)) << '\n';
column = 0; column = 0;
} else } else
os << '.'; os << to_utf8(docstring(1, c));
break;
case 0x2014: // — U+2014 EM DASH
case 0x3002: // 。 U+3002 IDEOGRAPHIC FULL STOP
case 0xFF01: // U+FF01 FULLWIDTH EXCLAMATION MARK
case 0xFF1F: // U+FF1F FULLWIDTH QUESTION MARK
case 0xFF1A: // U+FF1A FULLWIDTH COLON
case 0xFF1B: // U+FF1B FULLWIDTH SEMICOLON
case 0xFF0C: // U+FF0C FULLWIDTH COMMA
flushString(os, write_buffer);
os << to_utf8(docstring(1, c)) << '\n';
column = 0;
break; break;
default: default:
if ((column > 70 && c == ' ') if (column > 500) {
|| column > 79) {
flushString(os, write_buffer); flushString(os, write_buffer);
os << '\n'; os << '\n';
column = 0; column = 0;

View File

@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in // Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own. // independent branches. Instead add your own.
#define LYX_FORMAT_LYX 610 // spitz: inset index macros #define LYX_FORMAT_LYX 611 // Yuriy Skalko: semantic linefeeds
#define LYX_FORMAT_TEX2LYX 610 #define LYX_FORMAT_TEX2LYX 611
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER #ifndef _MSC_VER