Q:

Break on space, textbox (specific condition)

I need to break on closest space to 30th character of texbox, and I got very good answer for that:
var x = 30;
if (textBox1.Text.Length > x) 
{
    var index = textBox1.Text.Select((c, i) => new {c, i}).TakeWhile(q => q.i < x).Where(q => q.c == ' ' ).Select(q => q.i).Last(); 
    textBox1.Text = textBox1.Text.Insert(index, Environment.NewLine);
} 

Only problem is that I need to exclude from counting characters like "@A", "@B", because they are used for text formatting.

A:

Although perhaps not the cleanest solution. If you simply count on @ (or perform a regex to detect patterns) and add that number to x (30) like:
            int paramCount = test.Where(c => c == '@').Count();

            var index = test.Select((c, i) => new { c, i })
                            .TakeWhile(q => q.i < x + paramCount)
                            .Where(q => q.c == ' ')
                            .Select(q => q.i)
                            .Last();

edit
In order to make sure your count only counts the first 30 characters (excluding '@'), you can perform an aggregate in advance:
            int paramCount = test.Select((c, i) => new { c, i })
                                 .Aggregate(0, (count, s) => s.c == '@' && s.i < x + count ? count + 1 : count);

