Browse Source

Renamed smart_insertions to start_inserts, and fixed a bug when removing deprecated nodes in preferences

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

2
CMakeLists.txt

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

13
src/config.cc

@ -141,14 +141,15 @@ bool Config::remove_deprecated_nodes(const boost::property_tree::ptree &default_
if(parent_path.size()>0)
parent_path+=".";
bool unchanged=true;
for(auto &node: config_cfg) {
auto path=parent_path+node.first;
for(auto it=config_cfg.begin();it!=config_cfg.end();) {
auto path=parent_path+it->first;
try {
default_cfg.get<std::string>(path);
unchanged&=remove_deprecated_nodes(default_cfg, node.second, path);
unchanged&=remove_deprecated_nodes(default_cfg, it->second, path);
++it;
}
catch(const std::exception &e) {
config_cfg.erase(node.first);
it=config_cfg.erase(it);
unchanged=false;
}
}
@ -195,8 +196,8 @@ void Config::get_source() {
source.show_whitespace_characters=source_json.get<std::string>("show_whitespace_characters");
source.smart_brackets=source_json.get<bool>("smart_brackets");
source.smart_insertions=source_json.get<bool>("smart_insertions");
if(source.smart_insertions)
source.smart_inserts=source_json.get<bool>("smart_inserts");
if(source.smart_inserts)
source.smart_brackets=true;
source.show_map = source_json.get<bool>("show_map");

2
src/config.h

@ -61,7 +61,7 @@ public:
std::string show_whitespace_characters;
bool smart_brackets;
bool smart_insertions;
bool smart_inserts;
bool show_map;
std::string map_font_size;

6
src/files.h

@ -41,10 +41,10 @@ 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": "If smart_insertions is enabled, this option is automatically enabled. When inserting an already closed bracket, the cursor might instead be moved, avoiding the need of arrow keys after autocomplete",
"smart_brackets_comment": "If smart_inserts is enabled, this option is automatically enabled. When inserting an already closed bracket, the cursor might instead be moved, avoiding the need of arrow keys after autocomplete",
"smart_brackets": true,
"smart_insertions_comment": "When for instance inserting (, () gets inserted. Applies to: (), [], \", '. Also enables pressing ; inside an expression before a final ) to insert ; at the end of line, and deletions of empty insertions",
"smart_insertions": false,
"smart_inserts_comment": "When for instance inserting (, () gets inserted. Applies to: (), [], \", '. Also enables pressing ; inside an expression before a final ) to insert ; at the end of line, and deletions of empty insertions",
"smart_inserts": false,
"show_map": true,
"map_font_size": "1",
"show_git_diff": true,

4
src/source.cc

@ -1230,7 +1230,7 @@ bool Source::View::on_key_press_event(GdkEventKey* key) {
get_buffer()->end_user_action();
return true;
}
if(Config::get().source.smart_insertions && on_key_press_event_smart_insertions(key)) {
if(Config::get().source.smart_inserts && on_key_press_event_smart_inserts(key)) {
get_buffer()->end_user_action();
return true;
}
@ -1788,7 +1788,7 @@ bool Source::View::on_key_press_event_smart_brackets(GdkEventKey *key) {
return false;
}
bool Source::View::on_key_press_event_smart_insertions(GdkEventKey *key) {
bool Source::View::on_key_press_event_smart_inserts(GdkEventKey *key) {
if(get_buffer()->get_has_selection()) {
bool perform_insertion=false;
char left_char, right_char;

2
src/source.h

@ -140,7 +140,7 @@ namespace Source {
bool on_key_press_event_basic(GdkEventKey* key);
bool on_key_press_event_bracket_language(GdkEventKey* key);
bool on_key_press_event_smart_brackets(GdkEventKey* key);
bool on_key_press_event_smart_insertions(GdkEventKey* key);
bool on_key_press_event_smart_inserts(GdkEventKey* key);
bool on_button_press_event(GdkEventButton *event) override;
bool on_focus_in_event(GdkEventFocus* focus_event) override;

Loading…
Cancel
Save