Keep sidebar current tab state correct when changing tabs.  Fix #250.  Fix #249.