Enable per-project line wrapping
This commit is contained in:
parent
2b98487a70
commit
cb2aebcfd9
@ -9029,6 +9029,22 @@
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="check_line_wrapping1">
|
||||
<property name="label" translatable="yes">Line wrapping</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Wrap the line at the window border and continue it on the next line. Note: line wrapping has a high performance cost for large documents so should be disabled on slow machines.</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
|
13
src/editor.c
13
src/editor.c
@ -375,6 +375,17 @@ static gboolean is_style_php(gint style)
|
||||
}
|
||||
|
||||
|
||||
static gint editor_get_line_wrapping(void)
|
||||
{
|
||||
if (app->project)
|
||||
return app->project->priv->line_wrapping;
|
||||
if (!editor_prefs.line_wrapping)
|
||||
return 0;
|
||||
else
|
||||
return editor_prefs.line_wrapping;
|
||||
}
|
||||
|
||||
|
||||
static gint editor_get_long_line_type(void)
|
||||
{
|
||||
if (app->project)
|
||||
@ -415,6 +426,7 @@ get_default_prefs(void)
|
||||
eprefs.indentation = (GeanyIndentPrefs*)editor_get_indent_prefs(NULL);
|
||||
eprefs.long_line_type = editor_get_long_line_type();
|
||||
eprefs.long_line_column = editor_get_long_line_column();
|
||||
eprefs.line_wrapping = editor_get_line_wrapping();
|
||||
return &eprefs;
|
||||
}
|
||||
|
||||
@ -5009,6 +5021,7 @@ void editor_apply_update_prefs(GeanyEditor *editor)
|
||||
sci_set_autoc_max_height(sci, editor_prefs.symbolcompletion_max_height);
|
||||
SSM(sci, SCI_AUTOCSETDROPRESTOFWORD, editor_prefs.completion_drops_rest_of_word, 0);
|
||||
|
||||
editor_set_line_wrapping(editor, editor_get_line_wrapping());
|
||||
editor_set_indentation_guides(editor);
|
||||
|
||||
sci_set_visible_white_spaces(sci, editor_prefs.show_white_space);
|
||||
|
@ -684,6 +684,7 @@ static GeanyProject *create_project(void)
|
||||
|
||||
project->priv->long_line_behaviour = 1 /* use global settings */;
|
||||
project->priv->long_line_column = editor_prefs.long_line_column;
|
||||
project->priv->line_wrapping = editor_prefs.line_wrapping;
|
||||
|
||||
app->project = project;
|
||||
return project;
|
||||
@ -1063,6 +1064,8 @@ static gboolean load_config(const gchar *filename)
|
||||
"long_line_behaviour", 1 /* follow global */);
|
||||
p->priv->long_line_column = utils_get_setting_integer(config, "long line marker",
|
||||
"long_line_column", editor_prefs.long_line_column);
|
||||
p->priv->line_wrapping = utils_get_setting_boolean(config, "line_wrapping",
|
||||
"line_wrapping", editor_prefs.line_wrapping);
|
||||
apply_editor_prefs();
|
||||
|
||||
build_load_menu(config, GEANY_BCS_PROJ, (gpointer)p);
|
||||
@ -1132,6 +1135,7 @@ static gboolean write_config(gboolean emit_signal)
|
||||
g_key_file_set_integer(config, "long line marker", "long_line_behaviour", p->priv->long_line_behaviour);
|
||||
g_key_file_set_integer(config, "long line marker", "long_line_column", p->priv->long_line_column);
|
||||
|
||||
g_key_file_set_boolean(config, "line_wrapping", "line_wrapping", p->priv->line_wrapping);
|
||||
/* store the session files into the project too */
|
||||
if (project_prefs.project_session)
|
||||
configuration_save_session_files(config);
|
||||
@ -1289,6 +1293,12 @@ static void init_stash_prefs(void)
|
||||
"strip_trailing_spaces", file_prefs.strip_trailing_spaces, "check_trailing_spaces1");
|
||||
stash_group_add_toggle_button(group, &priv.replace_tabs,
|
||||
"replace_tabs", file_prefs.replace_tabs, "check_replace_tabs1");
|
||||
group = stash_group_new("file_prefs");
|
||||
add_stash_group(group);
|
||||
|
||||
group = stash_group_new("line_wrapping");
|
||||
stash_group_add_toggle_button(group, &priv.line_wrapping,
|
||||
"line_wrapping", editor_prefs.line_wrapping, "check_line_wrapping1");
|
||||
add_stash_group(group);
|
||||
/* apply defaults */
|
||||
kf = g_key_file_new();
|
||||
|
@ -39,6 +39,7 @@ typedef struct GeanyProjectPrivate
|
||||
GPtrArray *build_filetypes_list; /* Project has custom filetype builds for these. */
|
||||
gint long_line_behaviour; /* 0 - disabled, 1 - follow global settings, 2 - enabled (custom) */
|
||||
gint long_line_column; /* Long line marker position. */
|
||||
gboolean line_wrapping;
|
||||
}
|
||||
GeanyProjectPrivate;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user