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

diff popup cuts off start of text #419

Closed
pixilation opened this issue May 31, 2017 · 0 comments
Closed

diff popup cuts off start of text #419

pixilation opened this issue May 31, 2017 · 0 comments
Labels

Comments

@pixilation
Copy link

Description

The diff popup cuts off the start of text when indenting using tabs.

diff-popup-cuts-off-text

When determining how much leading whitespace to trim, the diff popup converts tabs to spaces using the current Sublime tab width. However it doesn't convert these tabs to spaces when actually removing them. For example, if I have 2 leading tabs it will convert them to 8 spaces, then remove the 2 tabs and the next 6 characters.

Fix

This problem occurs in factory.py. It was first introduced in 90234a4

This can be fixed by changing line[min_indent:] to line.expandtabs(tab_width)[min_indent:] in the 3 places it occurs.

Support Info

  • Sublime Text 3126
  • Platform: windows
  • Arch: x64
  • GitGutter 42dcafc
  • Install via PC: False
  • git version 2.13.0.windows.1
  • mdpopups 1.13.1
  • markdown 2.6.6
  • pygments 2.1a0
  • jinja2 2.8

Steps to Reproduce Issue

  1. Create a blank repo and commit a file that uses tab indenting
  2. Modify a tab indented line and open the diff popup
@r-stein r-stein added the bug label May 31, 2017
deathaxe added a commit that referenced this issue May 31, 2017
In order to correctly detect the visual indention mixed with `\t` and ` ` the
_get_min_indention() function expands tabs before calculation. The returned
value is always the indention in characters.

As tabs are not expanded when actually dedenting the lines, too much characters
are removed causing the text being cut off if code is indented by tabs.
@deathaxe deathaxe closed this as completed Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants