Skip to content

wrap_lines Command Indenting Text After Certain Symbols at Line Start #6840

@vwheeler63

Description

@vwheeler63

Description of the bug

Because I do a lot of editing of reStructuredText (.rst) files, I run into this a lot, though I have proven that it is not related to the current Syntax in force, because it does exactly the same thing whether the file is a .rst file or in a .txt file where the Syntax is "Plain Text". (Also tested in Safe Mode with same results.)

Given the following paragraph:

To support this, Python has a way to put definitions in a file and use them in a aaaaaaaaaa
:term:`script` or in an interactive instance of the interpreter.  Such a file is aaaaaaaaaa
called a :term:`module`; definitions from a module can be :term:`import`\ ed into
other modules or into the main module (the collection of variables that you have
access to in a script executed at the top level and in calculator mode
[interactive mode]).

the aaaaaaaaaa "words" were placed where they are to force a wrap (set via rulers at column 86).

If the caret is in the first line, I get this:

To support this, Python has a way to put definitions in a file and use them in a
aaaaaaaaaa
:term:`script` or in an interactive instance of the interpreter.  Such a file is aaaaaaaaaa
called a :term:`module`; definitions from a module can be :term:`import`\ ed into
other modules or into the main module (the collection of variables that you have
access to in a script executed at the top level and in calculator mode
[interactive mode]).

(Seems to be interpreting the :term: as the beginning of a new paragraph?)

If the caret is in the 2nd line or below that in the above paragraph, I get this:

To support this, Python has a way to put definitions in a file and use them in a aaaaaaaaaa
:term:`script` or in an interactive instance of the interpreter.  Such a file is
 aaaaaaaaaa called a :term:`module`; definitions from a module can be :term:`import`\
 ed into other modules or into the main module (the collection of variables that you
 have access to in a script executed at the top level and in calculator mode
 [interactive mode]).

with all the lines below the :term: indented exactly 1 space.

As stated above, this behavior does not seem to be impacted by the current Syntax. And there is no use case that I can think of where I want the end of my paragraph indented differently than the start of my paragraph.

This behavior can also be demonstrated with this paragraph, apparently triggered by a double-quotation mark leading line 2:

To support this, Python has a way to put definitions in a file and use them in a aaaaaaaaaa
"script" or in an interactive instance of the interpreter.  Such a file is aaaaaaaaaaaaaa
called a :term:`module`; definitions from a module can be :term:`import`\ ed into
other modules or into the main module (the collection of variables that you have
access to in a script executed at the top level and in calculator mode
[interactive mode]).

in which the exact same behavior occurs: If the caret is on line 2 or below, all the lines below "script" get indented by 1 space.

If it would help, I can help fix this, but I know it is "internal" in the Sublime Text source, which I do not currently have access to.

Of note, and in the same area (wrap_lines command):

When a paragraph being wrapped contains a parenthetical section, the space before the opening parentheses is lost. Example:

Under certain circumstances, a paragraph containing

sitting in (e.g. keyword, keyword category, number, symbol, comment, etc.).

this string will turn into

sitting in(e.g. keyword, keyword category, number, symbol, comment, etc.).
          ^
          +-- space gets lost.

This is difficult to reproduce, but I run into it almost every day.

Steps to reproduce

  1. Start ST in Safe Mode
  2. Copy/paste the first paragraph above into the editing area.
  3. Place caret on line 2 or below within the paragraph.
  4. Hit [alt+q] (default key bound to wrap_lines command).
  5. Observe lines below the :term: are indented by 1 space.

This can also be reproduced with the 2nd paragraph where :term:`script` has been replaced by "script" with a double-quote leading the line, with the same results. (Single quote also produces the same results.)

Expected behavior

  1. The 2nd line of the paragraph, in each case, should be recognized as part of the paragraph starting with the 1st line, and

  2. the lines below the :term:`script` and "script" by 1 space should be left-aligned with the rest of the paragraph.

Actual behavior

As stated in the description above.

Sublime Text build number

4200

Operating system & version

Windows 10 x64 (up to date)

(Linux) Desktop environment and/or window manager

n/a

Additional information

This MAY be related (but not identical to) these issues:

OpenGL context information


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions