From 3aeb2d4d9869d9e92af71a97809a762b7403af93 Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 14 Aug 2018 14:42:29 +0200 Subject: [PATCH] Fixed indentation when pasting Python code where the first line ends with : --- src/source_base.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/source_base.cc b/src/source_base.cc index a3e048d..6fca2d1 100644 --- a/src/source_base.cc +++ b/src/source_base.cc @@ -736,6 +736,17 @@ void Source::BaseView::paste() { first_paste_line_has_tabs = true; paste_line_tabs = tabs; } + else if(language && language->get_id() == "python") { // Special case for Python code where the first line ends with ':' + char last_char = 0; + for(auto &chr : line) { + if(chr != ' ' && chr != '\t') + last_char = chr; + } + if(last_char == ':') { + first_paste_line_has_tabs = true; + paste_line_tabs = tabs; + } + } first_paste_line = false; } else if(!empty_line)