Browse Source

Added preference item: smart_brackets

merge-requests/365/head
eidheim 9 years ago
parent
commit
2150557600
  1. 2
      CMakeLists.txt
  2. 2
      src/config.cc
  3. 2
      src/config.h
  4. 2
      src/files.h
  5. 4
      src/source.cc

2
CMakeLists.txt

@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 2.8.8)
project(juci)
set(JUCI_VERSION "1.2.1.2")
set(JUCI_VERSION "1.2.1.3")
set(CPACK_PACKAGE_NAME "jucipp")
set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim <eidheim@gmail.com>")

2
src/config.cc

@ -194,6 +194,8 @@ void Config::get_source() {
source.cleanup_whitespace_characters=source_json.get<bool>("cleanup_whitespace_characters");
source.show_whitespace_characters=source_json.get<std::string>("show_whitespace_characters");
source.smart_brackets=source_json.get<bool>("smart_brackets");
source.show_map = source_json.get<bool>("show_map");
source.map_font_size = source_json.get<std::string>("map_font_size");

2
src/config.h

@ -60,6 +60,8 @@ public:
bool cleanup_whitespace_characters;
std::string show_whitespace_characters;
bool smart_brackets;
bool show_map;
std::string map_font_size;
bool show_git_diff;

2
src/files.h

@ -41,6 +41,8 @@ R"RAW(
"cleanup_whitespace_characters": false,
"show_whitespace_characters_comment": "Determines what kind of whitespaces should be drawn. Use comma-separated list of: space, tab, newline, nbsp, leading, text, trailing or all",
"show_whitespace_characters": "",
"smart_brackets_comment": "When inserting an already closed bracket, the cursor might instead be moved, avoiding the need of arrow keys after autocomplete",
"smart_brackets": true,
"show_map": true,
"map_font_size": "1",
"show_git_diff": true,

4
src/source.cc

@ -1683,8 +1683,9 @@ bool Source::View::on_key_press_event_bracket_language(GdkEventKey* key) {
}
}
}
if(Config::get().source.smart_brackets) {
//Move after ')' if closed expression
else if(key->keyval==GDK_KEY_parenright) {
if(key->keyval==GDK_KEY_parenright) {
if(*iter==')') {
if(open_close_bracket_count(iter, '(', ')')==0) {
iter.forward_char();
@ -1723,6 +1724,7 @@ bool Source::View::on_key_press_event_bracket_language(GdkEventKey* key) {
}
}
}
}
get_buffer()->end_user_action();
return on_key_press_event_basic(key);

Loading…
Cancel
Save