Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix behavior of commands like '4>' and '4<' #98

Closed
wants to merge 6 commits into from
Closed

Fix behavior of commands like '4>' and '4<' #98

wants to merge 6 commits into from

Conversation

skyronic
Copy link

Previous Behavior:

Let's assume we have a code block, and we have selected the entire block:

foo()
{
    bar()
}

Selecting the entire block and entering the command '>>' results in the output

    foo()
    {
        bar()
    }

Which is the same as vim. But if we select the original block and issue the command '3>', we see the result:

            foo()
    {
        bar()
    }

Wheras, the same command issued through vim would result in:

            foo()
            {
                bar()
            }

After doing a little investigating, I realized that "3>" calls the "vi_indent" command three times.

The first time, it indents the entire block of text and deselects it. Since the caret is only on the first line for the second and third time the "vi_indent" function is called, only the first line gets indented.

The real proper fix for this bug would be to not call "transform_selection_regions" until the last call of vi_indent but this seemed like a simpler hack.

Previous Behavior:

Let's assume we have a code block, and we have selected the entire block:

	foo()
	{
		bar()
	}

Selecting the entire block and entering the command '>>' results in the output

		foo()
		{
			bar()
		}

Which is the same as vim. But if we select the original block and issue the command '3>',
we see the result:

				foo()
		{
			bar()
		}

Wheras, the same command issued through vim would result in:

				foo()
				{
					bar()
				}

After doing a little investigating, I realized that "3>" calls the "vi_indent" command three times.

The first time, it indents the entire block of text and deselects it. Since the caret is only on the first
line for the second and third time the "vi_indent" function is called, only the first line gets indented.

The real proper fix for this bug would be to not call "transform_selection_regions" until the last call of vi_indent
but this seemed like a simpler hack.
misfo added a commit to misfo/Vintage that referenced this pull request Apr 6, 2012
guillermooo and others added 5 commits May 19, 2012 13:39
'<*> jumps to first non-whitespace character on line
bypass registers if using the null register (:_)
For some reason, I am encountering a bug in certain syntaxes
where view.has_non_empty_selection_region returns False instead
of true.

It seems to work adequately well in case this change is turned off
@bronson bronson mentioned this pull request Nov 10, 2012
Closed
@deanproxy
Copy link

why in the world hasn't this been fixed yet? We're going into version 3 of sublime text and this issue still exists...

@skyronic skyronic closed this Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants