Bug or feature? Unexpected formatting change

rw
rwfranz
Posts: 94
Joined: Thu May 28, 2015 9:41 pm
Platform: Windows

Fri Sep 14, 2018 11:45 am Post

Start a document in "No Style."
Stays in "No style," until I add a paragraph in "Code Block."
Then, it stays in code block until I change it to "No Style," but...
after I enter a line of text in "No style," and add a carriage return...
the new line of text entered will be in "Code Block."

This would be really helpful if I were writing some sort of alternating text, where I'm in and out of Code segments. However, the fact that once I add "Code Block" code to a document, I end up having to undo Code Block formatting, is a bit concerning.

Video of the behavior is at https://drive.google.com/open?id=1O2fuo2cerAzTwme0pzRSMd5qnc8x3rI3 .
Note, this is a document where a foreign character was previously added (part of a string: 1234567890123456â), and then deleted; I'm not sure if that's causing this or not. That string is not part of this document, but is part of another document in the test project.

Subsequent testing: a brand new project, brand new document, shows the same behavior with respect to Code Block formatting.
If I add a line in "Caption", "Block Quote", or "Centered Text" style after the Code Block, the Code Block formatting issue (every time I add a new line in No Style, it's in Code Block style) stops.

Which leads me to believe this may be a feature? Or perhaps Code Block is malformed in some way?

So the question: Bug or feature? I'm inclined to think this is a bug; the behavior was a complete surprise.

rw
rwfranz
Posts: 94
Joined: Thu May 28, 2015 9:41 pm
Platform: Windows

Tue Sep 18, 2018 2:32 am Post

rwfranz wrote:Start a document in "No Style."
Stays in "No style," until I add a paragraph in "Code Block."
Then, it stays in code block until I change it to "No Style," but...
after I enter a line of text in "No style," and add a carriage return...
the new line of text entered will be in "Code Block."

...

Subsequent testing: a brand new project, brand new document, shows the same behavior with respect to Code Block formatting.
If I add a line in "Caption", "Block Quote", or "Centered Text" style after the Code Block, the Code Block formatting issue (every time I add a new line in No Style, it's in Code Block style) stops.


Revisited this.

I created a new document, added the line "No Style 1234567890"<enter>
Changed to Code Block style, added the the line "Code Block 1234567890"<enter>
Changed to No Style, added the line "No Style 1234567890" (directly entered; not pasted).

At each version, I viewed the contents.rtf of that project for that document.
It appears that using "No Style" after a carriage return does not terminate the prior style if it's Code Block.

Here's an RTF text showing the three versions in succession (with titles that aren't RTF):

Code: Select all

V1: contest, one line, No Style


{\rtf1\ansi\ansicpg1252\uc1\deff0
{\fonttbl{\f0\fnil\fcharset0\fprq2 DejaVuSerif;}}
{\colortbl;\red0\green0\blue0;\red255\green255\blue255;\red128\green128\blue128;}
\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\fet2\ftnbj\aenddoc
\pgnrestart\pgnstarts0
\pard\plain \tx0\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2880\tx3600\tx4320\fi360\sa120\sb120\ltrch\loch {\f0\fs28\b0\i0 No Style 1234567890}}



V2: contents, two lines No Style 1234567890: Code Block 1234567890


{\rtf1\ansi\ansicpg1252\uc1\deff0
{\fonttbl{\f0\fnil\fcharset0\fprq2 DejaVuSerif;}{\f1\fnil\fcharset0\fprq2 Consolas;}}
{\colortbl;\red0\green0\blue0;\red255\green255\blue255;\red128\green128\blue128;}
\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\fet2\ftnbj\aenddoc
\pgnrestart\pgnstarts0
\pard\plain \tx0\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2880\tx3600\tx4320\fi360\sa120\sb120\ltrch\loch {\f0\fs28\b0\i0 No Style 1234567890}
\par\pard\plain \tx720\tx1080\tx1440\tx1800\tx2160\li720\ltrch\loch {\f1\fs22\b0\i0 <$Scr_Ps::0>Code Block 1234567890<!$Scr_Ps::0>}}



V3: contents, three lines No Style 1234567890: Code Block 1234567890: No Style 1234567890



{\rtf1\ansi\ansicpg1252\uc1\deff0
{\fonttbl{\f0\fnil\fcharset0\fprq2 DejaVuSerif;}{\f1\fnil\fcharset0\fprq2 Consolas;}}
{\colortbl;\red0\green0\blue0;\red255\green255\blue255;\red128\green128\blue128;}
\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\fet2\ftnbj\aenddoc
\pgnrestart\pgnstarts0
\pard\plain \tx0\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2880\tx3600\tx4320\fi360\sa120\sb120\ltrch\loch {\f0\fs28\b0\i0 No Style 1234567890}
\par\pard\plain \tx720\tx1080\tx1440\tx1800\tx2160\li720\ltrch\loch {\f1\fs22\b0\i0 <$Scr_Ps::0>Code Block 1234567890}
\par\pard\plain \tx0\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2880\tx3600\tx4320\fi360\sa120\sb120\ltrch\loch {\f0\fs28\b0\i0 No Style 1234567890<!$Scr_Ps::0>}}


So changing from "Code Block" to "No Style" isn't terminating the Code Block style. We can still see the <!$Scr...> terminator at the end of the "No Style" line.

I then tried adding "Heading 2 1234567890" and this results:

Code: Select all

{\rtf1\ansi\ansicpg1252\uc1\deff0
{\fonttbl{\f0\fnil\fcharset0\fprq2 DejaVuSerif;}{\f1\fnil\fcharset0\fprq2 Consolas;}{\f2\fnil\fcharset0\fprq2 Consolas-Bold;}}
{\colortbl;\red0\green0\blue0;\red255\green255\blue255;\red128\green128\blue128;}
\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\fet2\ftnbj\aenddoc
\pgnrestart\pgnstarts0
\pard\plain \tx0\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2880\tx3600\tx4320\fi360\sa120\sb120\ltrch\loch {\f0\fs28\b0\i0 No Style 1234567890}
\par\pard\plain \tx720\tx1080\tx1440\tx1800\tx2160\li720\ltrch\loch {\f1\fs22\b0\i0 <$Scr_Ps::0>Code Block 1234567890}
\par\pard\plain \tx0\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2880\tx3600\tx4320\fi360\sa120\sb120\ltrch\loch {\f0\fs28\b0\i0 No Style 1234567890<!$Scr_Ps::0><$Scr_Ps::1>}
\par\pard\plain \tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sb260\sl262\slmult1\ltrch\loch {\f2\fs26\b1\i0 <$Scr_H::2>Heading 2 1234567890<!$Scr_H::2><!$Scr_Ps::1>}}


Changing to a named style DOES terminate the prior style. But changing to No Style does not.

Hope that helps.