From 120d5531999dd77bd40ff3c16c201e7a6c8c7f68 Mon Sep 17 00:00:00 2001 From: eidheim Date: Sun, 22 Jul 2018 19:12:35 +0200 Subject: [PATCH] New python files will have 4 space indentation --- src/source.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/source.cc b/src/source.cc index b9bf05e..1df7eb0 100644 --- a/src/source.cc +++ b/src/source.cc @@ -223,18 +223,16 @@ Source::View::View(const boost::filesystem::path &file_path, const Glib::RefPtr< tab_char = Config::get().source.default_tab_char; tab_size = Config::get().source.default_tab_size; if(Config::get().source.auto_tab_char_and_size) { - auto tab_char_and_size = find_tab_char_and_size(); - if(tab_char_and_size.second != 0) { - if(tab_char != tab_char_and_size.first || tab_size != tab_char_and_size.second) { - std::string tab_str; - if(tab_char_and_size.first == ' ') - tab_str = ""; - else - tab_str = ""; + if(get_buffer()->size() == 0 && language && language->get_id() == "python") { + tab_char = ' '; + tab_size = 4; + } + else { + auto tab_char_and_size = find_tab_char_and_size(); + if(tab_char_and_size.second != 0) { + tab_char = tab_char_and_size.first; + tab_size = tab_char_and_size.second; } - - tab_char = tab_char_and_size.first; - tab_size = tab_char_and_size.second; } } set_tab_char_and_size(tab_char, tab_size);