Call editor_apply_update_prefs() from editor_create_widget() so

correct tab width and other settings are applied for Split Window
plugin.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4323 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2009-10-15 17:55:30 +00:00
parent 0b8c46a8a8
commit 120af21ccb
4 changed files with 14 additions and 6 deletions

View File

@ -19,6 +19,10 @@
filetypes.common settings get set too.
Make highlighting_set_styles() take GeanyFiletype pointer instead of
filetype id.
* src/document.c, src/editor.c, plugins/splitwindow.c:
Call editor_apply_update_prefs() from editor_create_widget() so
correct tab width and other settings are applied for Split Window
plugin.
2009-10-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -87,14 +87,15 @@ static void on_unsplit(GtkMenuItem *menuitem, gpointer user_data);
/* line numbers visibility */
static void set_line_numbers(ScintillaObject * sci, gboolean set, gint extra_width)
static void set_line_numbers(ScintillaObject * sci, gboolean set)
{
if (set)
{
gchar tmp_str[15];
gint len = scintilla_send_message(sci, SCI_GETLINECOUNT, 0, 0);
gint width;
g_snprintf(tmp_str, 15, "_%d%d", len, extra_width);
g_snprintf(tmp_str, 15, "_%d", len);
width = scintilla_send_message(sci, SCI_TEXTWIDTH, STYLE_LINENUMBER, (sptr_t) tmp_str);
scintilla_send_message(sci, SCI_SETMARGINWIDTHN, 0, width);
scintilla_send_message(sci, SCI_SETMARGINSENSITIVEN, 0, FALSE); /* use default behaviour */
@ -109,16 +110,20 @@ static void set_line_numbers(ScintillaObject * sci, gboolean set, gint extra_wid
static void sync_to_current(ScintillaObject *sci, ScintillaObject *current)
{
gpointer sdoc;
gint pos;
/* set the new sci widget to view the existing Scintilla document */
sdoc = (gpointer) scintilla_send_message(current, SCI_GETDOCPOINTER, 0, 0);
scintilla_send_message(sci, SCI_SETDOCPOINTER, 0, (sptr_t) sdoc);
highlighting_set_styles(sci, edit_window.editor->document->file_type);
pos = sci_get_current_position(current);
sci_set_current_position(sci, pos, TRUE);
/* override some defaults */
set_line_numbers(sci, TRUE, 0);
scintilla_send_message(sci, SCI_SETMARGINWIDTHN, 1, 0 ); /* hide marker margin */
set_line_numbers(sci, geany->editor_prefs->show_linenumber_margin);
scintilla_send_message(sci, SCI_SETMARGINWIDTHN, 1, 0 ); /* hide marker margin (no commands) */
scintilla_send_message(sci, SCI_SETMARGINWIDTHN, 2, 0 ); /* hide fold margin (no toggle callback) */
}

View File

@ -569,8 +569,6 @@ static GeanyDocument *document_create(const gchar *utf8_filename)
doc->editor = editor_create(doc);
editor_apply_update_prefs(doc->editor);
sidebar_openfiles_add(doc); /* sets doc->iter */
notebook_new_tab(doc);

View File

@ -4693,6 +4693,7 @@ ScintillaObject *editor_create_widget(GeanyEditor *editor)
editor_set_indent_type(editor, iprefs->type);
editor_set_font(editor, interface_prefs.editor_font);
editor_apply_update_prefs(editor);
/* if editor already had a widget, restore it */
if (old)