Preserving tabs and line breaks in when switching from HTML to Visual Editor

Add to function.php

add_filter('tiny_mce_before_init', 'tiny_mce_before_init');

And function tiny_mce_before_init:

function tiny_mce_before_init($init) {
 $init['setup'] = "function(ed) {
     ed.onBeforeSetContent.add(function(ed, o) {
     if ( o.content.indexOf('<pre') != -1) {
     o.content = o.content.replace(/<pre[^>]*>[\\s\\S]+?<\\/pre>/g, function(a) {
     return a.replace(/(\\r\\n|\\n)/g, '<br />');
    });
   }
  });
 }";
 return $init;
}

http://core.trac.wordpress.org/ticket/19666 – it’s known bug, there is workaround but not fix tabs only new line chars