I'll take a look soon.


On Tuesday, November 5, 2019 at 11:20:18 PM UTC+1, Stein Somers wrote:
>
> To reproduce: compare 2 empty files. In Settings, make sure "Smart tab 
> char" in on. On the right, insert 1 line with 1 character and a newline. 
> Select the line. Press tab (and seek cover).
>
> I filed this under TortoiseGit 
> <https://gitlab.com/tortoisegit/tortoisegit/issues/3449> but noticed the 
> code was copied from TortoiseSVN. Digging further, the bug comes from a 
> single changeset 25713 by one Stefan K, specifically to "improve 
> auto-detection of tab-mode" which replaced the safe code above ? 
> GetViewLine(i)[0] : '\0' with the one crashing now.
>
> Apart from the bug I have some remarks about the 
> CBaseView::GetIndentCharsForLine code here:
>
>    - if (line.GetLength() > m_nTabSize): if it counted the number of 
>    leading spaces, I would understand. But just length, how is that a hint 
>    that spaces are wanted? Anyway, the fact that lines usually are longer is 
>    the reason nTabMode is set and the crashing code is skipped.
>    - bool above = i > 0... and not >= 0 while in this example y = 0 and 
>    GetViewLine(y) indeed returns the first line. So if there's a tab on the 
>    line above, we want to insert tabs, but not if that line is the first 
> line??
>    - nTabMode = 1 (meaning spaces) if both the nth line above and nth 
>    line below are longer than tab size. Even if I understood that rule, why 
>    not if the 1st line above is longer, the 1st line below is not, but the 
> 2nd 
>    line below is longer?
>    - if (m_nTabMode & TABMODE_SMARTINDENT): why twice? Probably the good 
>    intent was to move the nTabMode == -1 test out of the for loop to this 
>    more visible place (hence the not-yet-useful break statements inside the 
>    loop).
>
> Stein
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TortoiseSVN" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tortoisesvn/2e357ea1-c4e6-44ce-a938-d6351a5fb4f7%40googlegroups.com.

Reply via email to