]> git.lyx.org Git - lyx.git/commitdiff
Add "semantic linefeeds" after punctuation marks.
authorYuriy Skalko <yuriy.skalko@gmail.com>
Sun, 27 Nov 2022 16:30:26 +0000 (18:30 +0200)
committerYuriy Skalko <yuriy.skalko@gmail.com>
Mon, 28 Nov 2022 09:58:53 +0000 (11:58 +0200)
We already had such breaks for dot.

File format change.

development/FORMAT
lib/lyx2lyx/lyx_2_4.py
src/Paragraph.cpp
src/version.h

index 0c41d8801cac835667807d1da7a2c66946528e06..5fcf13ebf103df4cbafc03f51351bf408c7be057 100644 (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> 
        * Format incremented to 610: InsetIndexMacros and new IndexInset params:
          - \begin_inset IndexMacro [see|seealso|subentry|sortkey], relating to
index 73826a5f59373a3e9bfc1b12b73ed82fcbd25ee6..5c0507a5af78618612ed85b3d7c44630908d0022 100644 (file)
@@ -4621,10 +4621,12 @@ convert = [
            [607, []],
            [608, []],
            [609, []],
-           [610, []]
+           [610, []],
+           [611, []]
           ]
 
-revert =  [[609, [revert_index_macros]],
+revert =  [[610, []],
+           [609, [revert_index_macros]],
            [608, [revert_document_metadata]],
            [607, [revert_docbook_mathml_prefix]],
            [606, [revert_spellchecker_ignore]],
index 3b3bc3913e715f10cc908d0243387d212aa1d457..453b1e1bb57e8c75d775410b8ecdc2cd2018b372 100644 (file)
@@ -1746,16 +1746,34 @@ void Paragraph::write(ostream & os, BufferParams const & bparams,
                        column = 0;
                        break;
                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);
                        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 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;
                default:
-                       if ((column > 70 && c == ' ')
-                           || column > 79) {
+                       if (column > 500) {
                                flushString(os, write_buffer);
                                os << '\n';
                                column = 0;
index b496d1045d5e984c5490169d6dd6504a1715df0e..bfcd9869aedf325408184b2e7bad75db5d96565c 100644 (file)
@@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 610 // spitz: inset index macros
-#define LYX_FORMAT_TEX2LYX 610
+#define LYX_FORMAT_LYX 611 // Yuriy Skalko: semantic linefeeds
+#define LYX_FORMAT_TEX2LYX 611
 
 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
 #ifndef _MSC_VER