Browse Source

Fixed indentation when pasting Python code where the first line ends with :

merge-requests/389/head
eidheim 7 years ago
parent
commit
3aeb2d4d98
  1. 11
      src/source_base.cc

11
src/source_base.cc

@ -736,6 +736,17 @@ void Source::BaseView::paste() {
first_paste_line_has_tabs = true; first_paste_line_has_tabs = true;
paste_line_tabs = tabs; 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; first_paste_line = false;
} }
else if(!empty_line) else if(!empty_line)

Loading…
Cancel
Save