From 80cae66884fdfb40144035a15df25391e7dd6073 Mon Sep 17 00:00:00 2001 From: eidheim Date: Sun, 14 Jun 2015 20:55:58 +0200 Subject: [PATCH] Yet another minor indentation fix. --- juci/source.cc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/juci/source.cc b/juci/source.cc index d479b77..c1ff97d 100644 --- a/juci/source.cc +++ b/juci/source.cc @@ -435,15 +435,20 @@ bool Source::Controller::OnKeyPress(GdkEventKey* key) { size_t line_nr=buffer()->get_insert()->get_iter().get_line(); if(line_nr>0 && sm[1].str().size()>=model().config().tab_size) { string previous_line=view().GetLine(line_nr-1); - if(std::regex_match(previous_line, sm2, no_bracket_statement_regex)) - buffer()->insert_at_cursor("\n"+sm2[1].str()); - else if(std::regex_match(previous_line, sm2, no_bracket_no_para_statement_regex)) - buffer()->insert_at_cursor("\n"+sm2[1].str()); - else - buffer()->insert_at_cursor("\n"+sm[1].str()); + if(!std::regex_match(previous_line, sm2, bracket_regex)) { + if(std::regex_match(previous_line, sm2, no_bracket_statement_regex)) { + buffer()->insert_at_cursor("\n"+sm2[1].str()); + view().scroll_to(buffer()->get_insert()); + return true; + } + else if(std::regex_match(previous_line, sm2, no_bracket_no_para_statement_regex)) { + buffer()->insert_at_cursor("\n"+sm2[1].str()); + view().scroll_to(buffer()->get_insert()); + return true; + } + } } - else - buffer()->insert_at_cursor("\n"+sm[1].str()); + buffer()->insert_at_cursor("\n"+sm[1].str()); view().scroll_to(buffer()->get_insert()); } return true;