AutoWrap icon indicating copy to clipboard operation
AutoWrap copied to clipboard

The new line isn't indented properly

Open Hubro opened this issue 10 years ago • 14 comments

When typing a comment like this:

    # Make sure the HTTP response code is always 200. Codes should be sent by

And typing outside the wrap column, the result is this:

    # Make sure the HTTP response code is always 200. Codes should be sent by
# the JSON response.

One would expect the result to be this:

    # Make sure the HTTP response code is always 200. Codes should be sent by
    # the JSON response.

And indeed, if one uses Alt+q to do the indentation rather than this plugin, the latter is the case.

Hubro avatar Oct 09 '14 06:10 Hubro

Hi @Hubro, it should be fixed by now. Somehow Sublime does not indent comment correctly, so now I first indent the line and then comment the line.

randy3k avatar Oct 09 '14 06:10 randy3k

I appreciate the quick response, but it unfortunately didn't work. I installed the most recent version from GitHub and checked the contents of the package to confirm that your fix was there.

Hubro avatar Oct 09 '14 06:10 Hubro

That's strange, it works fine for me now..

randy3k avatar Oct 09 '14 07:10 randy3k

Oopps..I can reproduce the issue now in some situations..

randy3k avatar Oct 09 '14 07:10 randy3k

Ok, it seems that Sublime Text 3 caches packages even through reinstalls. Even though I installed your most recent version, Sublime Text 3 was still using the old, deleted one. Restarting the application fixed it. Things appear to be working now.

Hubro avatar Oct 09 '14 07:10 Hubro

In which situations can you still reproduce this issue? i can confirm them if you'd like.

Hubro avatar Oct 09 '14 07:10 Hubro

This one works

    x = x + 1
    # comment comment comment comment comment comment comment comment
    y = y + 1

But this one do not

x = x + 1
    # comment comment comment comment comment comment comment comment
y = y + 1

Though, it would be argued that the second case is not important.

randy3k avatar Oct 09 '14 07:10 randy3k

Seems to work for me:

require "json"
    # Foo bar baz woefijqpwefijqwpefijqwepfiqwj eopfij qweopfij qweopfijqw
module AddressKitServer

=>

require "json"
    # Foo bar baz woefijqpwefijqwpefijqwepfiqwj eopfij qweopfij qweopfijqw
    # feowij qpwoeijf qwpoefij qpoweif j
module AddressKitServer

Hubro avatar Oct 09 '14 07:10 Hubro

It works for some languages such as Python, but not for some others such as C...

randy3k avatar Oct 09 '14 07:10 randy3k

As the major issue has been solved, I will leave this minor issue for the future. I believe there is no quick fix for this one.

randy3k avatar Oct 09 '14 07:10 randy3k

Could you perhaps use the wrap_lines command already in Sublime Text instead of wrapping manually? It seems to work perfectly. Just execute it immediately when the user crosses the word wrap column.

You can test by disabling auto wrap, typing a line that crosses the text wrap column, then pressing alt+q (on Windows).

Hubro avatar Oct 09 '14 07:10 Hubro

I use it mostly for latex. But the default wrap_lines function is very buggy in handling latex code. That's why I wrote this plugin.

randy3k avatar Oct 09 '14 07:10 randy3k

How about using the default wrap_lines in all cases except in latex code?

Hubro avatar Oct 09 '14 07:10 Hubro

I will probably leave it as is for the moment. Thanks anyway for the comments.

randy3k avatar Oct 09 '14 08:10 randy3k