Browse Source

Added preference item tab_indents_line (default: true) fixes #226, and now uses raw string literals in src/files.h

merge-requests/365/head
eidheim 10 years ago
parent
commit
41760f606c
  1. 7
      src/config.cc
  2. 1
      src/config.h
  3. 639
      src/files.h
  4. 9
      src/source.cc

7
src/config.cc

@ -49,7 +49,7 @@ void Config::load() {
catch(const std::exception &e) { catch(const std::exception &e) {
::Terminal::get().print("Error: could not parse "+config_json+": "+e.what()+"\n", true); ::Terminal::get().print("Error: could not parse "+config_json+": "+e.what()+"\n", true);
std::stringstream ss; std::stringstream ss;
ss << configjson; ss << default_config_file;
boost::property_tree::read_json(ss, cfg); boost::property_tree::read_json(ss, cfg);
retrieve_config(); retrieve_config();
} }
@ -63,7 +63,7 @@ void Config::find_or_create_config_files() {
boost::filesystem::create_directories(config_dir); // io exp captured by calling method boost::filesystem::create_directories(config_dir); // io exp captured by calling method
if (!boost::filesystem::exists(config_json)) if (!boost::filesystem::exists(config_json))
filesystem::write(config_json, configjson); filesystem::write(config_json, default_config_file);
auto juci_style_path = home/"styles"; auto juci_style_path = home/"styles";
boost::filesystem::create_directories(juci_style_path); // io exp captured by calling method boost::filesystem::create_directories(juci_style_path); // io exp captured by calling method
@ -160,7 +160,7 @@ void Config::update_config_file() {
try { try {
if(cfg.get<std::string>("version")!=JUCI_VERSION) { if(cfg.get<std::string>("version")!=JUCI_VERSION) {
std::stringstream ss; std::stringstream ss;
ss << configjson; ss << default_config_file;
boost::property_tree::read_json(ss, default_cfg); boost::property_tree::read_json(ss, default_cfg);
cfg_ok=false; cfg_ok=false;
if(cfg.count("version")>0) if(cfg.count("version")>0)
@ -196,6 +196,7 @@ void Config::get_source() {
source.default_tab_char = source_json.get<char>("default_tab_char"); source.default_tab_char = source_json.get<char>("default_tab_char");
source.default_tab_size = source_json.get<unsigned>("default_tab_size"); source.default_tab_size = source_json.get<unsigned>("default_tab_size");
source.auto_tab_char_and_size = source_json.get<bool>("auto_tab_char_and_size"); source.auto_tab_char_and_size = source_json.get<bool>("auto_tab_char_and_size");
source.tab_indents_line = source_json.get<bool>("tab_indents_line");
source.wrap_lines = source_json.get<bool>("wrap_lines"); source.wrap_lines = source_json.get<bool>("wrap_lines");

1
src/config.h

@ -64,6 +64,7 @@ public:
bool auto_tab_char_and_size; bool auto_tab_char_and_size;
char default_tab_char; char default_tab_char;
unsigned default_tab_size; unsigned default_tab_size;
bool tab_indents_line;
bool wrap_lines; bool wrap_lines;
bool highlight_current_line; bool highlight_current_line;
bool show_line_numbers; bool show_line_numbers;

639
src/files.h

@ -2,331 +2,342 @@
#define JUCI_FILES_H_ #define JUCI_FILES_H_
#include <string> #include <string>
#define JUCI_VERSION "1.1.3-3" #define JUCI_VERSION "1.1.3-4"
const std::string configjson = const std::string default_config_file = R"RAW({
"{\n" "version": ")RAW"+std::string(JUCI_VERSION)+R"RAW(",
" \"version\": \""+std::string(JUCI_VERSION)+"\",\n" "default_window_size": {
" \"default_window_size\": {\n" "width": 800,
" \"width\": 800,\n" "height": 600
" \"height\": 600\n" },
" },\n" "gtk_theme": {
" \"gtk_theme\": {\n" "name_comment": "Use \"\" for default theme, At least these two exist on all systems: Adwaita, Raleigh",
" \"name_comment\": \"Use \\\"\\\" for default theme, At least these two exist on all systems: Adwaita, Raleigh\",\n" "name": "",
" \"name\": \"\",\n" "variant_comment": "Use \"\" for default variant, and \"dark\" for dark theme variant. Note that not all themes support dark variant, but for instance Adwaita does",
" \"variant_comment\": \"Use \\\"\\\" for default variant, and \\\"dark\\\" for dark theme variant. Note that not all themes support dark variant, but for instance Adwaita does\",\n" "variant": ""
" \"variant\": \"\"\n" },
" },\n" "terminal": {
" \"terminal\": {\n" "history_size": 1000,
" \"history_size\": 1000,\n" "font_comment": "Use \"\" to use source.font with slightly smaller size",
" \"font_comment\": \"Use \\\"\\\" to use source.font with slightly smaller size\",\n" "font": ""
" \"font\": \"\"\n" },
" },\n" "source": {
" \"source\": {\n" "style_comment": "Use \"\" for default style, and for instance juci-dark or juci-dark-blue together with dark gtk_theme variant. Styles from normal gtksourceview install: classic, cobalt, kate, oblivion, solarized-dark, solarized-light, tango",
" \"style_comment\": \"Use \\\"\\\" for default style, and for instance juci-dark or juci-dark-blue together with dark gtk_theme variant. Styles from normal gtksourceview install: classic, cobalt, kate, oblivion, solarized-dark, solarized-light, tango\",\n" "style": "juci-light",
" \"style\": \"juci-light\",\n" "font_comment": "Use \"\" for default font, and for instance \"Monospace 12\" to also set size",)RAW"
" \"font_comment\": \"Use \\\"\\\" for default font, and for instance \\\"Monospace 12\\\" to also set size\",\n"
#ifdef __APPLE__ #ifdef __APPLE__
" \"font\": \"Menlo 11\",\n" R"RAW(
"font": "Menlo 11",)RAW"
#else #else
#ifdef _WIN32 #ifdef _WIN32
" \"font\": \"Consolas\",\n" R"RAW(
"font": "Consolas",)RAW"
#else #else
" \"font\": \"Monospace\",\n" R"RAW(
"font": "Monospace",)RAW"
#endif #endif
#endif #endif
" \"cleanup_whitespace_characters_comment\": \"Remove trailing whitespace characters on save, and add trailing newline if missing\",\n" R"RAW(
" \"cleanup_whitespace_characters\": false,\n" "cleanup_whitespace_characters_comment": "Remove trailing whitespace characters on save, and add trailing newline if missing",
" \"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\",\n" "cleanup_whitespace_characters": false,
" \"show_whitespace_characters\": \"\",\n" "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_map\": true,\n" "show_whitespace_characters": "",
" \"map_font_size\": \"1\",\n" "show_map": true,
" \"spellcheck_language_comment\": \"Use \\\"\\\" to set language from your locale settings\",\n" "map_font_size": "1",
" \"spellcheck_language\": \"en_US\",\n" "spellcheck_language_comment": "Use \"\" to set language from your locale settings",
" \"auto_tab_char_and_size_comment\": \"Use false to always use default tab char and size\",\n" "spellcheck_language": "en_US",
" \"auto_tab_char_and_size\": true,\n" "auto_tab_char_and_size_comment": "Use false to always use default tab char and size",
" \"default_tab_char_comment\": \"Use \\\"\\t\\\" for regular tab\",\n" "auto_tab_char_and_size": true,
" \"default_tab_char\": \" \",\n" "default_tab_char_comment": "Use \"\t\" for regular tab",
" \"default_tab_size\": 2,\n" "default_tab_char": " ",
" \"wrap_lines\": false,\n" "default_tab_size": 2,
" \"highlight_current_line\": true,\n" "tab_indents_line": true,
" \"show_line_numbers\": true,\n" "wrap_lines": false,
" \"clang_types\": {\n" "highlight_current_line": true,
" \"8\": \"def:function\",\n" "show_line_numbers": true,
" \"21\": \"def:function\",\n" "clang_types": {
" \"22\": \"def:identifier\",\n" "8": "def:function",
" \"24\": \"def:function\",\n" "21": "def:function",
" \"25\": \"def:function\",\n" "22": "def:identifier",
" \"43\": \"def:type\",\n" "24": "def:function",
" \"44\": \"def:type\",\n" "25": "def:function",
" \"45\": \"def:type\",\n" "43": "def:type",
" \"46\": \"def:identifier\",\n" "44": "def:type",
" \"109\": \"def:string\",\n" "45": "def:type",
" \"702\": \"def:statement\",\n" "46": "def:identifier",
" \"705\": \"def:comment\"\n" "109": "def:string",
" },\n" "702": "def:statement",
" \"clang_format_style_comment\": \"IndentWidth, AccessModifierOffset and UseTab are set automatically. See http://clang.llvm.org/docs/ClangFormatStyleOptions.html\",\n" "705": "def:comment"
" \"clang_format_style\": \"ColumnLimit: 0, MaxEmptyLinesToKeep: 2\"\n" },
" },\n" "clang_format_style_comment": "IndentWidth, AccessModifierOffset and UseTab are set automatically. See http://clang.llvm.org/docs/ClangFormatStyleOptions.html",
" \"keybindings\": {\n" "clang_format_style": "ColumnLimit: 0, MaxEmptyLinesToKeep: 2"
" \"preferences\": \"<primary>comma\",\n" },
" \"quit\": \"<primary>q\",\n" "keybindings": {
" \"new_file\": \"<primary>n\",\n" "preferences": "<primary>comma",
" \"new_folder\": \"<primary><shift>n\",\n" "quit": "<primary>q",
" \"open_file\": \"<primary>o\",\n" "new_file": "<primary>n",
" \"open_folder\": \"<primary><shift>o\",\n" "new_folder": "<primary><shift>n",
" \"save\": \"<primary>s\",\n" "open_file": "<primary>o",
" \"save_as\": \"<primary><shift>s\",\n" "open_folder": "<primary><shift>o",
" \"print\": \"<primary>p\",\n" "save": "<primary>s",
" \"edit_undo\": \"<primary>z\",\n" "save_as": "<primary><shift>s",
" \"edit_redo\": \"<primary><shift>z\",\n" "print": "<primary>p",
" \"edit_cut\": \"<primary>x\",\n" "edit_undo": "<primary>z",
" \"edit_copy\": \"<primary>c\",\n" "edit_redo": "<primary><shift>z",
" \"edit_paste\": \"<primary>v\",\n" "edit_cut": "<primary>x",
" \"edit_find\": \"<primary>f\",\n" "edit_copy": "<primary>c",
" \"edit_set_tab\": \"\",\n" "edit_paste": "<primary>v",
" \"source_spellcheck\": \"\",\n" "edit_find": "<primary>f",
" \"source_spellcheck_clear\": \"\",\n" "edit_set_tab": "",
" \"source_spellcheck_next_error\": \"<primary><shift>e\",\n" "source_spellcheck": "",
" \"source_indentation_set_buffer_tab\": \"\",\n" "source_spellcheck_clear": "",
" \"source_indentation_auto_indent_buffer\": \"<primary><shift>i\",\n" "source_spellcheck_next_error": "<primary><shift>e",
" \"source_goto_line\": \"<primary>g\",\n" "source_indentation_set_buffer_tab": "",
" \"source_center_cursor\": \"<primary>l\",\n" "source_indentation_auto_indent_buffer": "<primary><shift>i",
" \"source_find_documentation\": \"<primary><shift>d\",\n" "source_goto_line": "<primary>g",
" \"source_goto_declaration\": \"<primary>d\",\n" "source_center_cursor": "<primary>l",
" \"source_goto_implementation\": \"<primary>i\",\n" "source_find_documentation": "<primary><shift>d",
" \"source_goto_usage\": \"<primary>u\",\n" "source_goto_declaration": "<primary>d",
" \"source_goto_method\": \"<primary>m\",\n" "source_goto_implementation": "<primary>i",
" \"source_rename\": \"<primary>r\",\n" "source_goto_usage": "<primary>u",
" \"source_goto_next_diagnostic\": \"<primary>e\",\n" "source_goto_method": "<primary>m",
" \"source_apply_fix_its\": \"<control>space\",\n" "source_rename": "<primary>r",
" \"project_set_run_arguments\": \"\",\n" "source_goto_next_diagnostic": "<primary>e",
" \"compile_and_run\": \"<primary>Return\",\n" "source_apply_fix_its": "<control>space",
" \"compile\": \"<primary><shift>Return\",\n" "project_set_run_arguments": "",
" \"run_command\": \"<alt>Return\",\n" "compile_and_run": "<primary>Return",
" \"kill_last_running\": \"<primary>Escape\",\n" "compile": "<primary><shift>Return",
" \"force_kill_last_running\": \"<primary><shift>Escape\",\n" "run_command": "<alt>Return",
" \"debug_set_run_arguments\": \"\",\n" "kill_last_running": "<primary>Escape",
" \"debug_start_continue\": \"<primary>y\",\n" "force_kill_last_running": "<primary><shift>Escape",
" \"debug_stop\": \"<primary><shift>y\",\n" "debug_set_run_arguments": "",
" \"debug_kill\": \"<primary><shift>k\",\n" "debug_start_continue": "<primary>y",
" \"debug_step_over\": \"<primary>j\",\n" "debug_stop": "<primary><shift>y",
" \"debug_step_into\": \"<primary>t\",\n" "debug_kill": "<primary><shift>k",
" \"debug_step_out\": \"<primary><shift>t\",\n" "debug_step_over": "<primary>j",
" \"debug_backtrace\": \"<primary><shift>j\",\n" "debug_step_into": "<primary>t",
" \"debug_show_variables\": \"<primary><shift>b\",\n" "debug_step_out": "<primary><shift>t",
" \"debug_run_command\": \"<alt><shift>Return\",\n" "debug_backtrace": "<primary><shift>j",
" \"debug_toggle_breakpoint\": \"<primary>b\",\n" "debug_show_variables": "<primary><shift>b",
" \"debug_goto_stop\": \"<primary><shift>l\",\n" "debug_run_command": "<alt><shift>Return",
"debug_toggle_breakpoint": "<primary>b",
"debug_goto_stop": "<primary><shift>l",)RAW"
#ifdef __linux #ifdef __linux
" \"next_tab\": \"<primary>Tab\",\n" R"RAW(
" \"previous_tab\": \"<primary><shift>Tab\",\n" "next_tab": "<primary>Tab",
"previous_tab": "<primary><shift>Tab",)RAW"
#else #else
" \"next_tab\": \"<primary><alt>Right\",\n" R"RAW(
" \"previous_tab\": \"<primary><alt>Left\",\n" "next_tab": "<primary><alt>Right",
"previous_tab": "<primary><alt>Left",)RAW"
#endif #endif
" \"close_tab\": \"<primary>w\"\n" R"RAW(
" },\n" "close_tab": "<primary>w"
" \"project\": {\n" },
" \"default_build_path_comment\": \"Use <project_directory_name> to insert the project top level directory name\",\n" "project": {
" \"default_build_path\": \"./build\",\n" "default_build_path_comment": "Use <project_directory_name> to insert the project top level directory name",
" \"debug_build_path_comment\": \"Use <project_directory_name> to insert the project top level directory name, and <default_build_path> to insert your default_build_path setting.\",\n" "default_build_path": "./build",
" \"debug_build_path\": \"<default_build_path>/debug\",\n" "debug_build_path_comment": "Use <project_directory_name> to insert the project top level directory name, and <default_build_path> to insert your default_build_path setting.",
"debug_build_path": "<default_build_path>/debug",)RAW"
#ifdef _WIN32 #ifdef _WIN32
" \"cmake_command\": \"cmake -G\\\"MSYS Makefiles\\\"\",\n" R"RAW(
"cmake_command": "cmake -G\"MSYS Makefiles\"",)RAW"
#else #else
" \"cmake_command\": \"cmake\",\n" R"RAW(
"cmake_command": "cmake",)RAW"
#endif #endif
" \"make_command\": \"cmake --build .\",\n" R"RAW(
" \"save_on_compile_or_run\": true,\n" "make_command": "cmake --build .",
" \"clear_terminal_on_compile\": true\n" "save_on_compile_or_run": true,
" },\n" "clear_terminal_on_compile": true
" \"documentation_searches\": {\n" },
" \"clang\": {\n" "documentation_searches": {
" \"separator\": \"::\",\n" "clang": {
" \"queries\": {\n" "separator": "::",
" \"@empty\": \"https://www.google.com/search?btnI&q=c%2B%2B+\",\n" "queries": {
" \"std\": \"https://www.google.com/search?btnI&q=site:http://www.cplusplus.com/reference/+\",\n" "@empty": "https://www.google.com/search?btnI&q=c%2B%2B+",
" \"boost\": \"https://www.google.com/search?btnI&q=site:http://www.boost.org/doc/libs/1_59_0/+\",\n" "std": "https://www.google.com/search?btnI&q=site:http://www.cplusplus.com/reference/+",
" \"Gtk\": \"https://www.google.com/search?btnI&q=site:https://developer.gnome.org/gtkmm/stable/+\",\n" "boost": "https://www.google.com/search?btnI&q=site:http://www.boost.org/doc/libs/1_59_0/+",
" \"@any\": \"https://www.google.com/search?btnI&q=\"\n" "Gtk": "https://www.google.com/search?btnI&q=site:https://developer.gnome.org/gtkmm/stable/+",
" }\n" "@any": "https://www.google.com/search?btnI&q="
" }\n" }
" }\n" }
"}\n"; }
}
const std::string juci_light_style = )RAW";
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"\n" const std::string juci_light_style = R"RAW(<?xml version="1.0" encoding="UTF-8"?>
"<style-scheme id=\"juci-light\" _name=\"juci\" version=\"1.0\">\n"
" <author>juCi++ team</author>\n" <style-scheme id="juci-light" _name="juci" version="1.0">
" <_description>Default juCi++ style</_description>\n" <author>juCi++ team</author>
"\n" <_description>Default juCi++ style</_description>
" <!-- Palette -->\n"
" <color name=\"white\" value=\"#FFFFFF\"/>\n" <!-- Palette -->
" <color name=\"black\" value=\"#000000\"/>\n" <color name="white" value="#FFFFFF"/>
" <color name=\"gray\" value=\"#888888\"/>\n" <color name="black" value="#000000"/>
" <color name=\"red\" value=\"#CC0000\"/>\n" <color name="gray" value="#888888"/>
" <color name=\"green\" value=\"#008800\"/>\n" <color name="red" value="#CC0000"/>
" <color name=\"blue\" value=\"#0000FF\"/>\n" <color name="green" value="#008800"/>
" <color name=\"dark-blue\" value=\"#002299\"/>\n" <color name="blue" value="#0000FF"/>
" <color name=\"yellow\" value=\"#FFFF00\"/>\n" <color name="dark-blue" value="#002299"/>
" <color name=\"light-yellow\" value=\"#FFFF88\"/>\n" <color name="yellow" value="#FFFF00"/>
" <color name=\"orange\" value=\"#FF8800\"/>\n" <color name="light-yellow" value="#FFFF88"/>
" <color name=\"purple\" value=\"#990099\"/>\n" <color name="orange" value="#FF8800"/>
"\n" <color name="purple" value="#990099"/>
" <style name=\"text\" foreground=\"#000000\" background=\"#FFFFFF\"/>\n"
" <style name=\"background-pattern\" background=\"#rgba(0,0,0,.03)\"/>\n" <style name="text" foreground="#000000" background="#FFFFFF"/>
" <style name=\"selection\" background=\"#4A90D9\"/>\n" <style name="background-pattern" background="#rgba(0,0,0,.03)"/>
"\n" <style name="selection" background="#4A90D9"/>
" <!-- Current Line Highlighting -->\n"
" <style name=\"current-line\" background=\"#rgba(0,0,0,.07)\"/>\n" <!-- Current Line Highlighting -->
"\n" <style name="current-line" background="#rgba(0,0,0,.07)"/>
" <!-- Bracket Matching -->\n"
" <style name=\"bracket-match\" foreground=\"white\" background=\"gray\" bold=\"true\"/>\n" <!-- Bracket Matching -->
" <style name=\"bracket-mismatch\" foreground=\"white\" background=\"#FF0000\" bold=\"true\"/>\n" <style name="bracket-match" foreground="white" background="gray" bold="true"/>
"\n" <style name="bracket-mismatch" foreground="white" background="#FF0000" bold="true"/>
" <!-- Search Matching -->\n"
" <style name=\"search-match\" background=\"yellow\"/>\n" <!-- Search Matching -->
"\n" <style name="search-match" background="yellow"/>
" <!-- Language specifics -->\n"
" <style name=\"def:builtin\" foreground=\"blue\"/>\n" <!-- Language specifics -->
" <style name=\"def:constant\" foreground=\"blue\"/>\n" <style name="def:builtin" foreground="blue"/>
" <style name=\"def:boolean\" foreground=\"red\"/>\n" <style name="def:constant" foreground="blue"/>
" <style name=\"def:decimal\" foreground=\"red\"/>\n" <style name="def:boolean" foreground="red"/>
" <style name=\"def:base-n-integer\" foreground=\"red\"/>\n" <style name="def:decimal" foreground="red"/>
" <style name=\"def:floating-point\" foreground=\"red\"/>\n" <style name="def:base-n-integer" foreground="red"/>
" <style name=\"def:complex\" foreground=\"red\"/>\n" <style name="def:floating-point" foreground="red"/>
" <style name=\"def:character\" foreground=\"red\"/>\n" <style name="def:complex" foreground="red"/>
" <style name=\"def:special-char\" foreground=\"red\"/>\n" <style name="def:character" foreground="red"/>
"\n\n" <style name="def:special-char" foreground="red"/>
" <!-- Language specifics used by clang-parser in default config -->\n"
" <style name=\"def:string\" foreground=\"red\"/>\n" <!-- Language specifics used by clang-parser in default config -->
" <style name=\"def:comment\" foreground=\"gray\"/>\n" <style name="def:string" foreground="red"/>
" <style name=\"def:statement\" foreground=\"blue\"/>\n" <style name="def:comment" foreground="gray"/>
" <style name=\"def:type\" foreground=\"blue\"/>\n" <style name="def:statement" foreground="blue"/>
" <style name=\"def:function\" foreground=\"dark-blue\"/>\n" <style name="def:type" foreground="blue"/>
" <style name=\"def:identifier\" foreground=\"purple\"/>\n" <style name="def:function" foreground="dark-blue"/>
" <style name=\"def:preprocessor\" foreground=\"green\"/>\n" <style name="def:identifier" foreground="purple"/>
" <style name=\"def:error\" foreground=\"red\"/>\n" <style name="def:preprocessor" foreground="green"/>
" <style name=\"def:warning\" foreground=\"orange\"/>\n" <style name="def:error" foreground="red"/>
" <style name=\"def:note\" foreground=\"black\" background=\"light-yellow\"/>\n" <style name="def:warning" foreground="orange"/>
"\n" <style name="def:note" foreground="black" background="light-yellow"/>
"</style-scheme>\n";
</style-scheme>
const std::string juci_dark_style = )RAW";
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"\n" const std::string juci_dark_style = R"RAW(<?xml version="1.0" encoding="UTF-8"?>
"<style-scheme id=\"juci-dark\" _name=\"juci\" version=\"1.0\">\n"
" <author>juCi++ team</author>\n" <style-scheme id="juci-dark" _name="juci" version="1.0">
" <_description>Dark juCi++ style</_description>\n" <author>juCi++ team</author>
"\n" <_description>Dark juCi++ style</_description>
" <!-- Palette -->\n"
" <color name=\"white\" value=\"#CCCCCC\"/>\n" <!-- Palette -->
" <color name=\"black\" value=\"#292929\"/>\n" <color name="white" value="#CCCCCC"/>
" <color name=\"gray\" value=\"#888888\"/>\n" <color name="black" value="#292929"/>
" <color name=\"red\" value=\"#FF9999\"/>\n" <color name="gray" value="#888888"/>
" <color name=\"green\" value=\"#AACC99\"/>\n" <color name="red" value="#FF9999"/>
" <color name=\"blue\" value=\"#9090FF\"/>\n" <color name="green" value="#AACC99"/>
" <color name=\"light-blue\" value=\"#AAAAFF\"/>\n" <color name="blue" value="#9090FF"/>
" <color name=\"purple\" value=\"#DD88DD\"/>\n" <color name="light-blue" value="#AAAAFF"/>
"\n" <color name="purple" value="#DD88DD"/>
" <style name=\"text\" foreground=\"white\" background=\"black\"/>\n"
" <style name=\"background-pattern\" background=\"#rgba(255,255,255,.04)\"/>\n" <style name="text" foreground="white" background="black"/>
" <style name=\"selection\" background=\"#215D9C\"/>\n" <style name="background-pattern" background="#rgba(255,255,255,.04)"/>
"\n" <style name="selection" background="#215D9C"/>
" <!-- Current Line Highlighting -->\n"
" <style name=\"current-line\" background=\"#rgba(255,255,255,.06)\"/>\n" <!-- Current Line Highlighting -->
"\n" <style name="current-line" background="#rgba(255,255,255,.06)"/>
" <!-- Bracket Matching -->\n"
" <style name=\"bracket-match\" foreground=\"black\" background=\"gray\" bold=\"true\"/>\n" <!-- Bracket Matching -->
" <style name=\"bracket-mismatch\" foreground=\"black\" background=\"#FF0000\" bold=\"true\"/>\n" <style name="bracket-match" foreground="black" background="gray" bold="true"/>
"\n" <style name="bracket-mismatch" foreground="black" background="#FF0000" bold="true"/>
" <!-- Search Matching -->\n"
" <style name=\"search-match\" foreground=\"black\" background=\"white\"/>\n" <!-- Search Matching -->
"\n" <style name="search-match" foreground="black" background="white"/>
" <!-- Language specifics -->\n"
" <style name=\"def:builtin\" foreground=\"blue\"/>\n" <!-- Language specifics -->
" <style name=\"def:constant\" foreground=\"blue\"/>\n" <style name="def:builtin" foreground="blue"/>
" <style name=\"def:boolean\" foreground=\"red\"/>\n" <style name="def:constant" foreground="blue"/>
" <style name=\"def:decimal\" foreground=\"red\"/>\n" <style name="def:boolean" foreground="red"/>
" <style name=\"def:base-n-integer\" foreground=\"red\"/>\n" <style name="def:decimal" foreground="red"/>
" <style name=\"def:floating-point\" foreground=\"red\"/>\n" <style name="def:base-n-integer" foreground="red"/>
" <style name=\"def:complex\" foreground=\"red\"/>\n" <style name="def:floating-point" foreground="red"/>
" <style name=\"def:character\" foreground=\"red\"/>\n" <style name="def:complex" foreground="red"/>
" <style name=\"def:special-char\" foreground=\"red\"/>\n" <style name="def:character" foreground="red"/>
"\n\n" <style name="def:special-char" foreground="red"/>
" <!-- Language specifics used by clang-parser in default config -->\n"
" <style name=\"def:string\" foreground=\"red\"/>\n" <!-- Language specifics used by clang-parser in default config -->
" <style name=\"def:comment\" foreground=\"gray\"/>\n" <style name="def:string" foreground="red"/>
" <style name=\"def:statement\" foreground=\"blue\"/>\n" <style name="def:comment" foreground="gray"/>
" <style name=\"def:type\" foreground=\"blue\"/>\n" <style name="def:statement" foreground="blue"/>
" <style name=\"def:function\" foreground=\"light-blue\"/>\n" <style name="def:type" foreground="blue"/>
" <style name=\"def:identifier\" foreground=\"purple\"/>\n" <style name="def:function" foreground="light-blue"/>
" <style name=\"def:preprocessor\" foreground=\"green\"/>\n" <style name="def:identifier" foreground="purple"/>
" <style name=\"def:error\" foreground=\"#FF6666\"/>\n" <style name="def:preprocessor" foreground="green"/>
" <style name=\"def:warning\" foreground=\"#FFE100\"/>\n" <style name="def:error" foreground="#FF6666"/>
" <style name=\"def:note\" foreground=\"white\" background=\"#444444\"/>\n" <style name="def:warning" foreground="#FFE100"/>
"\n" <style name="def:note" foreground="white" background="#444444"/>
"</style-scheme>\n";
</style-scheme>
const std::string juci_dark_blue_style = )RAW";
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"\n" const std::string juci_dark_blue_style = R"RAW(<?xml version="1.0" encoding="UTF-8"?>
"<style-scheme id=\"juci-dark-blue\" _name=\"juci\" version=\"1.0\">\n"
" <author>juCi++ team</author>\n" <style-scheme id="juci-dark-blue" _name="juci" version="1.0">
" <_description>Dark blue juCi++ style based on the Emacs deeper blue theme</_description>\n" <author>juCi++ team</author>
"\n" <_description>Dark blue juCi++ style based on the Emacs deeper blue theme</_description>
" <!-- Palette -->\n"
" <color name=\"white\" value=\"#D6D6D6\"/>\n" <!-- Palette -->
" <color name=\"dark-blue\" value=\"#202233\"/>\n" <color name="white" value="#D6D6D6"/>
" <color name=\"gray\" value=\"#919191\"/>\n" <color name="dark-blue" value="#202233"/>
" <color name=\"red\" value=\"#FF7777\"/>\n" <color name="gray" value="#919191"/>
" <color name=\"yellow\" value=\"#FFE100\"/>\n" <color name="red" value="#FF7777"/>
" <color name=\"light-yellow\" value=\"#EAC595\"/>\n" <color name="yellow" value="#FFE100"/>
" <color name=\"light-blue\" value=\"#00CCFF\"/>\n" <color name="light-yellow" value="#EAC595"/>
" <color name=\"green\" value=\"#14ECA8\"/>\n" <color name="light-blue" value="#00CCFF"/>
" <color name=\"blue\" value=\"#282A40\"/>\n" <color name="green" value="#14ECA8"/>
" <color name=\"orange\" value=\"#FF8800\"/>\n" <color name="blue" value="#282A40"/>
" <color name=\"light-green\" value=\"#A0DB6B\"/>\n" <color name="orange" value="#FF8800"/>
"\n" <color name="light-green" value="#A0DB6B"/>
" <style name=\"text\" foreground=\"white\" background=\"dark-blue\"/>\n"
" <style name=\"background-pattern\" background=\"#rgba(255,255,255,.04)\"/>\n" <style name="text" foreground="white" background="dark-blue"/>
" <style name=\"selection\" background=\"#215D9C\"/>\n" <style name="background-pattern" background="#rgba(255,255,255,.04)"/>
"\n" <style name="selection" background="#215D9C"/>
" <!-- Current Line Highlighting -->\n"
" <style name=\"current-line\" background=\"#rgba(255,255,255,.05)\"/>\n" <!-- Current Line Highlighting -->
"\n" <style name="current-line" background="#rgba(255,255,255,.05)"/>
" <!-- Bracket Matching -->\n"
" <style name=\"bracket-match\" foreground=\"dark-blue\" background=\"gray\" bold=\"true\"/>\n" <!-- Bracket Matching -->
" <style name=\"bracket-mismatch\" foreground=\"dark-blue\" background=\"#FF0000\" bold=\"true\"/>\n" <style name="bracket-match" foreground="dark-blue" background="gray" bold="true"/>
"\n" <style name="bracket-mismatch" foreground="dark-blue" background="#FF0000" bold="true"/>
" <!-- Search Matching -->\n"
" <style name=\"search-match\" foreground=\"dark-blue\" background=\"white\"/>\n" <!-- Search Matching -->
"\n" <style name="search-match" foreground="dark-blue" background="white"/>
" <!-- Language specifics -->\n"
" <style name=\"def:builtin\" foreground=\"light-blue\"/>\n" <!-- Language specifics -->
" <style name=\"def:constant\" foreground=\"light-blue\"/>\n" <style name="def:builtin" foreground="light-blue"/>
" <style name=\"def:boolean\" foreground=\"light-yellow\"/>\n" <style name="def:constant" foreground="light-blue"/>
" <style name=\"def:decimal\" foreground=\"light-yellow\"/>\n" <style name="def:boolean" foreground="light-yellow"/>
" <style name=\"def:base-n-integer\" foreground=\"light-yellow\"/>\n" <style name="def:decimal" foreground="light-yellow"/>
" <style name=\"def:floating-point\" foreground=\"light-yellow\"/>\n" <style name="def:base-n-integer" foreground="light-yellow"/>
" <style name=\"def:complex\" foreground=\"light-yellow\"/>\n" <style name="def:floating-point" foreground="light-yellow"/>
" <style name=\"def:character\" foreground=\"light-yellow\"/>\n" <style name="def:complex" foreground="light-yellow"/>
" <style name=\"def:special-char\" foreground=\"light-yellow\"/>\n" <style name="def:character" foreground="light-yellow"/>
"\n\n" <style name="def:special-char" foreground="light-yellow"/>
" <!-- Language specifics used by clang-parser in default config -->\n"
" <style name=\"def:string\" foreground=\"light-yellow\"/>\n" <!-- Language specifics used by clang-parser in default config -->
" <style name=\"def:comment\" foreground=\"gray\"/>\n" <style name="def:string" foreground="light-yellow"/>
" <style name=\"def:statement\" foreground=\"light-blue\"/>\n" <style name="def:comment" foreground="gray"/>
" <style name=\"def:type\" foreground=\"light-blue\"/>\n" <style name="def:statement" foreground="light-blue"/>
" <style name=\"def:function\" foreground=\"green\"/>\n" <style name="def:type" foreground="light-blue"/>
" <style name=\"def:identifier\" foreground=\"light-green\"/>\n" <style name="def:function" foreground="green"/>
" <style name=\"def:preprocessor\" foreground=\"yellow\"/>\n" <style name="def:identifier" foreground="light-green"/>
" <style name=\"def:error\" foreground=\"red\"/>\n" <style name="def:preprocessor" foreground="yellow"/>
" <style name=\"def:warning\" foreground=\"yellow\"/>\n" <style name="def:error" foreground="red"/>
" <style name=\"def:note\" foreground=\"white\" background=\"#404466\"/>\n" <style name="def:warning" foreground="yellow"/>
"\n" <style name="def:note" foreground="white" background="#404466"/>
"</style-scheme>\n";
</style-scheme>
)RAW";
#endif // JUCI_FILES_H_ #endif // JUCI_FILES_H_

9
src/source.cc

@ -1219,8 +1219,13 @@ bool Source::View::on_key_press_event_basic(GdkEventKey* key) {
get_buffer()->end_user_action(); get_buffer()->end_user_action();
return true; return true;
} }
//Indent right when clicking tab, no matter where in the line the cursor is. Also works on selected text. else if(key->keyval==GDK_KEY_Tab && (key->state&GDK_SHIFT_MASK)==0) {
else if(key->keyval==GDK_KEY_Tab) { if(!Config::get().source.tab_indents_line && !get_buffer()->get_has_selection()) {
get_buffer()->insert_at_cursor(tab);
get_buffer()->end_user_action();
return true;
}
//Indent right when clicking tab, no matter where in the line the cursor is. Also works on selected text.
//Special case if insert is at beginning of empty line: //Special case if insert is at beginning of empty line:
if(iter.starts_line() && iter.ends_line() && !get_buffer()->get_has_selection()) { if(iter.starts_line() && iter.ends_line() && !get_buffer()->get_has_selection()) {
auto prev_line_iter=iter; auto prev_line_iter=iter;

Loading…
Cancel
Save