SF.net SVN: geany: [2776] branches/editor-struct
ntrel at users.sourceforge.net
ntrel at xxxxx
Mon Jul 14 11:13:54 UTC 2008
Revision: 2776
http://geany.svn.sourceforge.net/geany/?rev=2776&view=rev
Author: ntrel
Date: 2008-07-14 04:13:54 -0700 (Mon, 14 Jul 2008)
Log Message:
-----------
Rename GeanyEditor::scintilla to GeanyEditor::sci.
Modified Paths:
--------------
branches/editor-struct/ChangeLog
branches/editor-struct/plugins/classbuilder.c
branches/editor-struct/plugins/export.c
branches/editor-struct/plugins/htmlchars.c
branches/editor-struct/plugins/vcdiff.c
branches/editor-struct/src/callbacks.c
branches/editor-struct/src/document.c
branches/editor-struct/src/editor.c
branches/editor-struct/src/editor.h
branches/editor-struct/src/filetypes.c
branches/editor-struct/src/keybindings.c
branches/editor-struct/src/keyfile.c
branches/editor-struct/src/main.c
branches/editor-struct/src/navqueue.c
branches/editor-struct/src/notebook.c
branches/editor-struct/src/printing.c
branches/editor-struct/src/search.c
branches/editor-struct/src/symbols.c
branches/editor-struct/src/tools.c
branches/editor-struct/src/treeviews.c
branches/editor-struct/src/ui_utils.c
Modified: branches/editor-struct/ChangeLog
===================================================================
--- branches/editor-struct/ChangeLog 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/ChangeLog 2008-07-14 11:13:54 UTC (rev 2776)
@@ -1,3 +1,14 @@
+2008-07-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/keybindings.c, src/printing.c, src/tools.c, src/navqueue.c,
+ src/treeviews.c, src/callbacks.c, src/notebook.c, src/keyfile.c,
+ src/filetypes.c, src/search.c, src/document.c, src/main.c,
+ src/editor.c, src/symbols.c, src/editor.h, src/ui_utils.c,
+ plugins/export.c, plugins/vcdiff.c, plugins/htmlchars.c,
+ plugins/classbuilder.c:
+ Rename GeanyEditor::scintilla to GeanyEditor::sci.
+
+
2008-07-11 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/document.c, src/editor.c, src/editor.h, src/ui_utils.c:
Modified: branches/editor-struct/plugins/classbuilder.c
===================================================================
--- branches/editor-struct/plugins/classbuilder.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/plugins/classbuilder.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -733,7 +733,7 @@
{
text = get_template_class_source(class_info);
doc = p_document->new_file(class_info->source, NULL, NULL);
- p_sci->set_text(doc->editor->scintilla, text);
+ p_sci->set_text(doc->editor->sci, text);
g_free(text);
}
@@ -741,7 +741,7 @@
{
text = get_template_class_header(class_info);
doc = p_document->new_file(class_info->header, NULL, NULL);
- p_sci->set_text(doc->editor->scintilla, text);
+ p_sci->set_text(doc->editor->sci, text);
g_free(text);
}
Modified: branches/editor-struct/plugins/export.c
===================================================================
--- branches/editor-struct/plugins/export.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/plugins/export.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -357,25 +357,25 @@
GString *body;
GString *cmds;
GString *latex;
- gint style_max = pow(2, p_sci->send_message(doc->editor->scintilla, SCI_GETSTYLEBITS, 0, 0));
+ gint style_max = pow(2, p_sci->send_message(doc->editor->sci, SCI_GETSTYLEBITS, 0, 0));
/* first read all styles from Scintilla */
for (i = 0; i < style_max; i++)
{
- styles[i][FORE] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETFORE, i, 0);
- styles[i][BACK] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETBACK, i, 0);
- styles[i][BOLD] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETBOLD, i, 0);
- styles[i][ITALIC] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETITALIC, i, 0);
+ styles[i][FORE] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETFORE, i, 0);
+ styles[i][BACK] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETBACK, i, 0);
+ styles[i][BOLD] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETBOLD, i, 0);
+ styles[i][ITALIC] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETITALIC, i, 0);
styles[i][USED] = 0;
}
/* read the document and write the LaTeX code */
body = g_string_new("");
- for (i = 0; i < p_sci->get_length(doc->editor->scintilla); i++)
+ for (i = 0; i < p_sci->get_length(doc->editor->sci); i++)
{
- style = p_sci->get_style_at(doc->editor->scintilla, i);
- c = p_sci->get_char_at(doc->editor->scintilla, i);
- c_next = p_sci->get_char_at(doc->editor->scintilla, i + 1);
+ style = p_sci->get_style_at(doc->editor->sci, i);
+ c = p_sci->get_char_at(doc->editor->sci, i);
+ c_next = p_sci->get_char_at(doc->editor->sci, i + 1);
if (style != old_style || ! block_open)
{
@@ -564,15 +564,15 @@
GString *body;
GString *css;
GString *html;
- gint style_max = pow(2, p_sci->send_message(doc->editor->scintilla, SCI_GETSTYLEBITS, 0, 0));
+ gint style_max = pow(2, p_sci->send_message(doc->editor->sci, SCI_GETSTYLEBITS, 0, 0));
/* first read all styles from Scintilla */
for (i = 0; i < style_max; i++)
{
- styles[i][FORE] = ROTATE_RGB(p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETFORE, i, 0));
- styles[i][BACK] = ROTATE_RGB(p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETBACK, i, 0));
- styles[i][BOLD] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETBOLD, i, 0);
- styles[i][ITALIC] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETITALIC, i, 0);
+ styles[i][FORE] = ROTATE_RGB(p_sci->send_message(doc->editor->sci, SCI_STYLEGETFORE, i, 0));
+ styles[i][BACK] = ROTATE_RGB(p_sci->send_message(doc->editor->sci, SCI_STYLEGETBACK, i, 0));
+ styles[i][BOLD] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETBOLD, i, 0);
+ styles[i][ITALIC] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETITALIC, i, 0);
styles[i][USED] = 0;
}
@@ -581,18 +581,18 @@
font_name = pango_font_description_get_family(font_desc);
/*font_size = pango_font_description_get_size(font_desc) / PANGO_SCALE;*/
/* take the zoom level also into account */
- font_size = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETSIZE, 0, 0);
+ font_size = p_sci->send_message(doc->editor->sci, SCI_STYLEGETSIZE, 0, 0);
if (use_zoom)
- font_size += p_sci->send_message(doc->editor->scintilla, SCI_GETZOOM, 0, 0);
+ font_size += p_sci->send_message(doc->editor->sci, SCI_GETZOOM, 0, 0);
/* read the document and write the HTML body */
body = g_string_new("");
- for (i = 0; i < p_sci->get_length(doc->editor->scintilla); i++)
+ for (i = 0; i < p_sci->get_length(doc->editor->sci); i++)
{
- style = p_sci->get_style_at(doc->editor->scintilla, i);
- c = p_sci->get_char_at(doc->editor->scintilla, i);
+ style = p_sci->get_style_at(doc->editor->sci, i);
+ c = p_sci->get_char_at(doc->editor->sci, i);
/* p_sci->get_char_at() takes care of index boundaries and return 0 if i is too high */
- c_next = p_sci->get_char_at(doc->editor->scintilla, i + 1);
+ c_next = p_sci->get_char_at(doc->editor->sci, i + 1);
if ((style != old_style || ! span_open) && ! isspace(c))
{
Modified: branches/editor-struct/plugins/htmlchars.c
===================================================================
--- branches/editor-struct/plugins/htmlchars.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/plugins/htmlchars.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -446,12 +446,12 @@
if (doc != NULL)
{
gchar *str;
- gint pos = p_sci->get_current_position(doc->editor->scintilla);
+ gint pos = p_sci->get_current_position(doc->editor->sci);
gtk_tree_model_get(model, iter, COLUMN_HTML_NAME, &str, -1);
if (NZV(str))
{
- p_sci->insert_text(doc->editor->scintilla, pos, str);
+ p_sci->insert_text(doc->editor->sci, pos, str);
g_free(str);
result = TRUE;
}
Modified: branches/editor-struct/plugins/vcdiff.c
===================================================================
--- branches/editor-struct/plugins/vcdiff.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/plugins/vcdiff.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -285,9 +285,9 @@
}
else
{
- p_sci->set_text(doc->editor->scintilla, text);
+ p_sci->set_text(doc->editor->sci, text);
book = GTK_NOTEBOOK(geany->main_widgets->notebook);
- page = gtk_notebook_page_num(book, GTK_WIDGET(doc->editor->scintilla));
+ page = gtk_notebook_page_num(book, GTK_WIDGET(doc->editor->sci));
gtk_notebook_set_current_page(book, page);
p_document->set_text_changed(doc, FALSE);
}
Modified: branches/editor-struct/src/callbacks.c
===================================================================
--- branches/editor-struct/src/callbacks.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/src/callbacks.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -112,7 +112,7 @@
{
if (insert_callback_from_menu)
{
- editor_info.click_pos = sci_get_current_position(doc->editor->scintilla);
+ editor_info.click_pos = sci_get_current_position(doc->editor->sci);
insert_callback_from_menu = FALSE;
}
}
@@ -305,7 +305,7 @@
gtk_editable_cut_clipboard(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && doc != NULL)
- sci_cut(doc->editor->scintilla);
+ sci_cut(doc->editor->sci);
else
if (GTK_IS_TEXT_VIEW(focusw))
{
@@ -327,7 +327,7 @@
gtk_editable_copy_clipboard(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && doc != NULL)
- sci_copy(doc->editor->scintilla);
+ sci_copy(doc->editor->sci);
else
if (GTK_IS_TEXT_VIEW(focusw))
{
@@ -360,12 +360,12 @@
gchar *content = gtk_clipboard_wait_for_text(gtk_clipboard_get(GDK_NONE));
if (content != NULL)
{
- sci_replace_sel(doc->editor->scintilla, content);
+ sci_replace_sel(doc->editor->sci, content);
g_free(content);
}
}
#else
- sci_paste(doc->editor->scintilla);
+ sci_paste(doc->editor->sci);
#endif
}
else
@@ -390,7 +390,7 @@
gtk_editable_delete_selection(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && doc != NULL)
- sci_clear(doc->editor->scintilla);
+ sci_clear(doc->editor->sci);
else
if (GTK_IS_TEXT_VIEW(focusw))
{
@@ -658,9 +658,9 @@
if (doc != NULL)
{
if (done++ % 3 == 0)
- sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin,
- (sci_get_zoom(doc->editor->scintilla) / 2));
- sci_zoom_in(doc->editor->scintilla);
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin,
+ (sci_get_zoom(doc->editor->sci) / 2));
+ sci_zoom_in(doc->editor->sci);
}
}
@@ -672,9 +672,9 @@
GeanyDocument *doc = document_get_current();
if (doc != NULL)
{
- if (sci_get_zoom(doc->editor->scintilla) == 0)
- sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
- sci_zoom_out(doc->editor->scintilla);
+ if (sci_get_zoom(doc->editor->sci) == 0)
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
+ sci_zoom_out(doc->editor->sci);
}
}
@@ -686,8 +686,8 @@
GeanyDocument *doc = document_get_current();
if (doc != NULL)
{
- sci_zoom_off(doc->editor->scintilla);
- sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
+ sci_zoom_off(doc->editor->sci);
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
}
}
@@ -779,8 +779,8 @@
{
GeanyDocument *doc = document_get_current();
if (ignore_callback || doc == NULL) return;
- sci_convert_eols(doc->editor->scintilla, SC_EOL_CRLF);
- sci_set_eol_mode(doc->editor->scintilla, SC_EOL_CRLF);
+ sci_convert_eols(doc->editor->sci, SC_EOL_CRLF);
+ sci_set_eol_mode(doc->editor->sci, SC_EOL_CRLF);
}
@@ -790,8 +790,8 @@
{
GeanyDocument *doc = document_get_current();
if (ignore_callback || doc == NULL) return;
- sci_convert_eols(doc->editor->scintilla, SC_EOL_LF);
- sci_set_eol_mode(doc->editor->scintilla, SC_EOL_LF);
+ sci_convert_eols(doc->editor->sci, SC_EOL_LF);
+ sci_set_eol_mode(doc->editor->sci, SC_EOL_LF);
}
@@ -801,8 +801,8 @@
{
GeanyDocument *doc = document_get_current();
if (ignore_callback || doc == NULL) return;
- sci_convert_eols(doc->editor->scintilla, SC_EOL_CR);
- sci_set_eol_mode(doc->editor->scintilla, SC_EOL_CR);
+ sci_convert_eols(doc->editor->sci, SC_EOL_CR);
+ sci_set_eol_mode(doc->editor->sci, SC_EOL_CR);
}
@@ -863,7 +863,7 @@
if (doc == NULL)
return;
- sci = doc->editor->scintilla;
+ sci = doc->editor->sci;
if (! sci_can_copy(sci))
{
keybindings_send_command(GEANY_KEY_GROUP_SELECT, GEANY_KEYS_SELECT_WORD);
@@ -984,7 +984,7 @@
if (doc == NULL)
return;
doc->readonly = ! doc->readonly;
- sci_set_readonly(doc->editor->scintilla, doc->readonly);
+ sci_set_readonly(doc->editor->sci, doc->readonly);
ui_update_tab_status(doc);
ui_update_statusbar(doc, -1);
}
@@ -1015,10 +1015,10 @@
if (doc == NULL)
return;
- if (sci_can_copy(doc->editor->scintilla))
+ if (sci_can_copy(doc->editor->sci))
{ /* take selected text if there is a selection */
- search_text = g_malloc(sci_get_selected_text_length(doc->editor->scintilla) + 1);
- sci_get_selected_text(doc->editor->scintilla, search_text);
+ search_text = g_malloc(sci_get_selected_text_length(doc->editor->sci) + 1);
+ sci_get_selected_text(doc->editor->sci, search_text);
flags = SCFIND_MATCHCASE;
}
else
@@ -1042,7 +1042,7 @@
g_return_if_fail(doc != NULL);
- sci_set_current_position(doc->editor->scintilla, editor_info.click_pos, FALSE);
+ sci_set_current_position(doc->editor->sci, editor_info.click_pos, FALSE);
symbols_goto_tag(editor_info.current_word, definition);
}
@@ -1066,8 +1066,8 @@
if (doc == NULL)
return;
- pos = sci_get_current_position(doc->editor->scintilla);
- editor_find_current_word(doc->editor->scintilla, pos, colour, sizeof colour, GEANY_WORDCHARS"#");
+ pos = sci_get_current_position(doc->editor->sci);
+ editor_find_current_word(doc->editor->sci, pos, colour, sizeof colour, GEANY_WORDCHARS"#");
tools_color_chooser(colour);
}
@@ -1186,12 +1186,12 @@
GeanyDocument *doc = document_get_current();
gint line = strtol(gtk_entry_get_text(GTK_ENTRY(user_data)), NULL, 10);
- if (doc != NULL && line > 0 && line <= sci_get_line_count(doc->editor->scintilla))
+ if (doc != NULL && line > 0 && line <= sci_get_line_count(doc->editor->sci))
{
gint pos;
line--; /* the user counts lines from 1, we begin at 0 so bring the user line to our one */
- pos = sci_get_position_from_line(doc->editor->scintilla, line);
+ pos = sci_get_position_from_line(doc->editor->sci, line);
editor_goto_pos(doc->editor, pos, TRUE);
}
else
@@ -1291,11 +1291,11 @@
/* symbols_get_current_function returns -1 on failure, so sci_get_position_from_line
* returns the current position, so it should be safe */
line = symbols_get_current_function(doc, &cur_tag);
- pos = sci_get_position_from_line(doc->editor->scintilla, line - 1);
+ pos = sci_get_position_from_line(doc->editor->sci, line - 1);
text = templates_get_template_function(doc->file_type->id, cur_tag);
- sci_insert_text(doc->editor->scintilla, pos, text);
+ sci_insert_text(doc->editor->sci, pos, text);
g_free(text);
}
@@ -1333,7 +1333,7 @@
verify_click_pos(doc); /* make sure that the click_pos is valid */
- sci_insert_text(doc->editor->scintilla, editor_info.click_pos, text);
+ sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
g_free(text);
}
@@ -1353,7 +1353,7 @@
verify_click_pos(doc); /* make sure that the click_pos is valid */
- sci_insert_text(doc->editor->scintilla, editor_info.click_pos, text);
+ sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
g_free(text);
}
@@ -1370,10 +1370,10 @@
return;
text = templates_get_template_changelog();
- sci_insert_text(doc->editor->scintilla, 0, text);
+ sci_insert_text(doc->editor->sci, 0, text);
/* sets the cursor to the right position to type the changelog text,
* the template has 21 chars + length of name and email */
- sci_goto_pos(doc->editor->scintilla, 21 + strlen(template_prefs.developer) + strlen(template_prefs.mail), TRUE);
+ sci_goto_pos(doc->editor->sci, 21 + strlen(template_prefs.developer) + strlen(template_prefs.mail), TRUE);
g_free(text);
}
@@ -1394,8 +1394,8 @@
fname = doc->file_name;
text = templates_get_template_fileheader(FILETYPE_ID(ft), fname);
- sci_insert_text(doc->editor->scintilla, 0, text);
- sci_goto_pos(doc->editor->scintilla, 0, FALSE);
+ sci_insert_text(doc->editor->sci, 0, text);
+ sci_goto_pos(doc->editor->sci, 0, FALSE);
g_free(text);
}
@@ -1456,8 +1456,8 @@
{
verify_click_pos(doc); /* make sure that the click_pos is valid */
- sci_insert_text(doc->editor->scintilla, editor_info.click_pos, time_str);
- sci_goto_pos(doc->editor->scintilla, editor_info.click_pos + strlen(time_str), FALSE);
+ sci_insert_text(doc->editor->sci, editor_info.click_pos, time_str);
+ sci_goto_pos(doc->editor->sci, editor_info.click_pos + strlen(time_str), FALSE);
}
else
{
@@ -1490,10 +1490,10 @@
text = g_strconcat("#include <", user_data, ">\n", NULL);
}
- sci_insert_text(doc->editor->scintilla, editor_info.click_pos, text);
+ sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
g_free(text);
if (pos >= 0)
- sci_goto_pos(doc->editor->scintilla, pos, FALSE);
+ sci_goto_pos(doc->editor->sci, pos, FALSE);
}
@@ -1591,7 +1591,7 @@
GeanyDocument *doc = document_get_current();
if (doc != NULL)
- sci_select_all(doc->editor->scintilla);
+ sci_select_all(doc->editor->sci);
}
@@ -1695,24 +1695,24 @@
if (doc == NULL)
return;
- if (sci_get_lines_selected(doc->editor->scintilla) > 1)
+ if (sci_get_lines_selected(doc->editor->sci) > 1)
{
- sci_cmd(doc->editor->scintilla, SCI_TAB);
+ sci_cmd(doc->editor->sci, SCI_TAB);
}
else
{
gint line, ind_pos, old_pos, new_pos, step;
- old_pos = sci_get_current_position(doc->editor->scintilla);
- line = sci_get_line_from_position(doc->editor->scintilla, old_pos);
- ind_pos = sci_get_line_indent_position(doc->editor->scintilla, line);
+ old_pos = sci_get_current_position(doc->editor->sci);
+ line = sci_get_line_from_position(doc->editor->sci, old_pos);
+ ind_pos = sci_get_line_indent_position(doc->editor->sci, line);
/* when using tabs increase cur pos by 1, when using space increase it by tab_width */
step = (doc->editor->use_tabs) ? 1 : editor_prefs.tab_width;
new_pos = (old_pos > ind_pos) ? old_pos + step : old_pos;
- sci_set_current_position(doc->editor->scintilla, ind_pos, TRUE);
- sci_cmd(doc->editor->scintilla, SCI_TAB);
- sci_set_current_position(doc->editor->scintilla, new_pos, TRUE);
+ sci_set_current_position(doc->editor->sci, ind_pos, TRUE);
+ sci_cmd(doc->editor->sci, SCI_TAB);
+ sci_set_current_position(doc->editor->sci, new_pos, TRUE);
}
}
@@ -1725,31 +1725,31 @@
if (doc == NULL)
return;
- if (sci_get_lines_selected(doc->editor->scintilla) > 1)
+ if (sci_get_lines_selected(doc->editor->sci) > 1)
{
- sci_cmd(doc->editor->scintilla, SCI_BACKTAB);
+ sci_cmd(doc->editor->sci, SCI_BACKTAB);
}
else
{
gint line, ind_pos, old_pos, new_pos, step, indent;
- old_pos = sci_get_current_position(doc->editor->scintilla);
- line = sci_get_line_from_position(doc->editor->scintilla, old_pos);
- ind_pos = sci_get_line_indent_position(doc->editor->scintilla, line);
+ old_pos = sci_get_current_position(doc->editor->sci);
+ line = sci_get_line_from_position(doc->editor->sci, old_pos);
+ ind_pos = sci_get_line_indent_position(doc->editor->sci, line);
step = (doc->editor->use_tabs) ? 1 : editor_prefs.tab_width;
new_pos = (old_pos >= ind_pos) ? old_pos - step : old_pos;
- if (ind_pos == sci_get_position_from_line(doc->editor->scintilla, line))
+ if (ind_pos == sci_get_position_from_line(doc->editor->sci, line))
return;
- sci_set_current_position(doc->editor->scintilla, ind_pos, TRUE);
- indent = sci_get_line_indentation(doc->editor->scintilla, line);
+ sci_set_current_position(doc->editor->sci, ind_pos, TRUE);
+ indent = sci_get_line_indentation(doc->editor->sci, line);
indent -= editor_prefs.tab_width;
if (indent < 0)
indent = 0;
- sci_set_line_indentation(doc->editor->scintilla, line, indent);
+ sci_set_line_indentation(doc->editor->sci, line, indent);
- sci_set_current_position(doc->editor->scintilla, new_pos, TRUE);
+ sci_set_current_position(doc->editor->sci, new_pos, TRUE);
}
}
@@ -1923,8 +1923,8 @@
if (doc == NULL)
return;
- sci_marker_delete_all(doc->editor->scintilla, 0); /* delete the yellow tag marker */
- sci_marker_delete_all(doc->editor->scintilla, 1); /* delete user markers */
+ sci_marker_delete_all(doc->editor->sci, 0); /* delete the yellow tag marker */
+ sci_marker_delete_all(doc->editor->sci, 1); /* delete user markers */
}
@@ -1947,10 +1947,10 @@
if (doc == NULL)
return;
- if (sci_can_copy(doc->editor->scintilla))
+ if (sci_can_copy(doc->editor->sci))
{ /* take selected text if there is a selection */
- word = g_malloc(sci_get_selected_text_length(doc->editor->scintilla) + 1);
- sci_get_selected_text(doc->editor->scintilla, word);
+ word = g_malloc(sci_get_selected_text_length(doc->editor->sci) + 1);
+ sci_get_selected_text(doc->editor->sci, word);
}
else
{
Modified: branches/editor-struct/src/document.c
===================================================================
--- branches/editor-struct/src/document.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/src/document.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -192,7 +192,7 @@
for (i = 0; i < documents_array->len; i++)
{
- if (documents[i]->is_valid && documents[i]->editor->scintilla == sci)
+ if (documents[i]->is_valid && documents[i]->editor->sci == sci)
return documents[i];
}
return NULL;
@@ -206,7 +206,7 @@
return -1;
return gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
- GTK_WIDGET(doc->editor->scintilla));
+ GTK_WIDGET(doc->editor->sci));
}
@@ -296,7 +296,7 @@
g_return_if_fail(doc != NULL);
- sci = doc->editor->scintilla;
+ sci = doc->editor->sci;
sci_set_mark_long_lines(sci, editor_prefs.long_line_type,
editor_prefs.long_line_column, editor_prefs.long_line_color);
@@ -376,7 +376,7 @@
* document), we need to force a redraw, so the expose event is triggered.
* This ensures we don't start colourising before all documents are opened/saved,
* only once the editor is drawn. */
- gtk_widget_queue_draw(GTK_WIDGET(doc->editor->scintilla));
+ gtk_widget_queue_draw(GTK_WIDGET(doc->editor->sci));
}
@@ -546,21 +546,21 @@
g_assert(doc != NULL);
- sci_set_undo_collection(doc->editor->scintilla, FALSE); /* avoid creation of an undo action */
+ sci_set_undo_collection(doc->editor->sci, FALSE); /* avoid creation of an undo action */
if (text)
- sci_set_text(doc->editor->scintilla, text);
+ sci_set_text(doc->editor->sci, text);
else
- sci_clear_all(doc->editor->scintilla);
+ sci_clear_all(doc->editor->sci);
- sci_set_eol_mode(doc->editor->scintilla, file_prefs.default_eol_character);
+ sci_set_eol_mode(doc->editor->sci, file_prefs.default_eol_character);
/* convert the eol chars in the template text in case they are different from
* from file_prefs.default_eol */
if (text != NULL)
- sci_convert_eols(doc->editor->scintilla, file_prefs.default_eol_character);
+ sci_convert_eols(doc->editor->sci, file_prefs.default_eol_character);
editor_set_use_tabs(doc->editor, editor_prefs.use_tabs);
- sci_set_undo_collection(doc->editor->scintilla, TRUE);
- sci_empty_undo_buffer(doc->editor->scintilla);
+ sci_set_undo_collection(doc->editor->sci, TRUE);
+ sci_empty_undo_buffer(doc->editor->sci);
doc->mtime = time(NULL);
@@ -574,18 +574,18 @@
document_set_filetype(doc, ft); /* also clears taglist */
if (ft == NULL)
- highlighting_set_styles(doc->editor->scintilla, GEANY_FILETYPES_NONE);
+ highlighting_set_styles(doc->editor->sci, GEANY_FILETYPES_NONE);
ui_set_window_title(doc);
build_menu_update(doc);
document_update_tag_list(doc, FALSE);
document_set_text_changed(doc, FALSE);
ui_document_show_hide(doc); /* update the document menu */
- sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
- sci_goto_pos(doc->editor->scintilla, 0, TRUE);
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
+ sci_goto_pos(doc->editor->sci, 0, TRUE);
/* "the" SCI signal (connect after initial setup(i.e. adding text)) */
- g_signal_connect((GtkWidget*) doc->editor->scintilla, "sci-notify", G_CALLBACK(on_editor_notification), doc);
+ g_signal_connect((GtkWidget*) doc->editor->sci, "sci-notify", G_CALLBACK(on_editor_notification), doc);
if (geany_object)
{
@@ -850,20 +850,20 @@
{
if (cl_options.goto_line >= 0)
{ /* goto line which was specified on command line and then undefine the line */
- sci_goto_line(editor->scintilla, cl_options.goto_line - 1, TRUE);
+ sci_goto_line(editor->sci, cl_options.goto_line - 1, TRUE);
editor->scroll_percent = 0.5F;
cl_options.goto_line = -1;
}
else if (pos > 0)
{
- sci_set_current_position(editor->scintilla, pos, FALSE);
+ sci_set_current_position(editor->sci, pos, FALSE);
editor->scroll_percent = 0.5F;
}
if (cl_options.goto_column >= 0)
{ /* goto column which was specified on command line and then undefine the column */
- gint cur_pos = sci_get_current_position(editor->scintilla);
- sci_set_current_position(editor->scintilla, cur_pos + cl_options.goto_column, FALSE);
+ gint cur_pos = sci_get_current_position(editor->sci);
+ sci_set_current_position(editor->sci, cur_pos + cl_options.goto_column, FALSE);
editor->scroll_percent = 0.5F;
cl_options.goto_column = -1;
}
@@ -911,7 +911,7 @@
editor_set_use_tabs(doc->editor, editor_prefs.use_tabs);
else
{ /* detect & set tabs/spaces */
- gboolean use_tabs = detect_use_tabs(doc->editor->scintilla);
+ gboolean use_tabs = detect_use_tabs(doc->editor->sci);
if (use_tabs != editor_prefs.use_tabs)
ui_set_statusbar(TRUE, _("Setting %s indentation mode."),
@@ -970,7 +970,7 @@
ui_add_recent_file(utf8_filename); /* either add or reorder recent item */
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
- (GtkWidget*) doc->editor->scintilla));
+ (GtkWidget*) doc->editor->sci));
g_free(utf8_filename);
g_free(locale_filename);
document_check_disk_status(doc, TRUE); /* force a file changed check */
@@ -993,20 +993,20 @@
if (! reload) doc = document_create(utf8_filename);
g_return_val_if_fail(doc != NULL, NULL); /* really should not happen */
- sci_set_undo_collection(doc->editor->scintilla, FALSE); /* avoid creation of an undo action */
- sci_empty_undo_buffer(doc->editor->scintilla);
+ sci_set_undo_collection(doc->editor->sci, FALSE); /* avoid creation of an undo action */
+ sci_empty_undo_buffer(doc->editor->sci);
/* add the text to the ScintillaObject */
- sci_set_readonly(doc->editor->scintilla, FALSE); /* to allow replacing text */
- sci_set_text(doc->editor->scintilla, filedata.data); /* NULL terminated data */
+ sci_set_readonly(doc->editor->sci, FALSE); /* to allow replacing text */
+ sci_set_text(doc->editor->sci, filedata.data); /* NULL terminated data */
queue_colourise(doc); /* Ensure the document gets colourised. */
/* detect & set line endings */
editor_mode = utils_get_line_endings(filedata.data, filedata.len);
- sci_set_eol_mode(doc->editor->scintilla, editor_mode);
+ sci_set_eol_mode(doc->editor->sci, editor_mode);
g_free(filedata.data);
- sci_set_undo_collection(doc->editor->scintilla, TRUE);
+ sci_set_undo_collection(doc->editor->sci, TRUE);
doc->mtime = filedata.mtime; /* get the modification time from file and keep it */
g_free(doc->encoding); /* if reloading, free old encoding */
@@ -1015,10 +1015,10 @@
store_saved_encoding(doc); /* store the opened encoding for undo/redo */
doc->readonly = readonly || filedata.readonly;
- sci_set_readonly(doc->editor->scintilla, doc->readonly);
+ sci_set_readonly(doc->editor->sci, doc->readonly);
/* update line number margin width */
- sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
/* set the cursor position according to pos, cl_options.goto_line and cl_options.goto_column */
set_cursor_position(doc->editor, pos);
@@ -1030,7 +1030,7 @@
doc->real_path = get_real_path_from_utf8(doc->file_name);
/* "the" SCI signal (connect after initial setup(i.e. adding text)) */
- g_signal_connect((GtkWidget*) doc->editor->scintilla, "sci-notify",
+ g_signal_connect((GtkWidget*) doc->editor->sci, "sci-notify",
G_CALLBACK(on_editor_notification), doc);
use_ft = (ft != NULL) ? ft : filetypes_detect_from_file(doc);
@@ -1149,7 +1149,7 @@
return FALSE;
/* try to set the cursor to the position before reloading */
- pos = sci_get_current_position(doc->editor->scintilla);
+ pos = sci_get_current_position(doc->editor->sci);
new_doc = document_open_file_full(doc, NULL, pos, doc->readonly,
doc->file_type, forced_enc);
return (new_doc != NULL);
@@ -1186,8 +1186,8 @@
gint line_start;
/* for some reason we can use byte count instead of character count here */
- *line = sci_get_line_from_position(doc->editor->scintilla, byte_pos);
- line_start = sci_get_position_from_line(doc->editor->scintilla, *line);
+ *line = sci_get_line_from_position(doc->editor->sci, byte_pos);
+ line_start = sci_get_position_from_line(doc->editor->sci, *line);
/* get the column in the line */
*column = byte_pos - line_start;
@@ -1195,7 +1195,7 @@
* skip one byte(i++) and decrease the column number which is based on byte count */
for (i = line_start; i < (line_start + *column); i++)
{
- if (sci_get_char_at(doc->editor->scintilla, i) < 0)
+ if (sci_get_char_at(doc->editor->sci, i) < 0)
{
(*column)--;
i++;
@@ -1217,14 +1217,14 @@
/* only search the first 3 lines */
ttf.chrg.cpMin = 0;
- ttf.chrg.cpMax = sci_get_position_from_line(doc->editor->scintilla, 3);
+ ttf.chrg.cpMax = sci_get_position_from_line(doc->editor->sci, 3);
ttf.lpstrText = (gchar*)filebase;
- if (sci_find_text(doc->editor->scintilla, SCFIND_MATCHCASE, &ttf) != -1)
+ if (sci_find_text(doc->editor->sci, SCFIND_MATCHCASE, &ttf) != -1)
{
- sci_target_start(doc->editor->scintilla, ttf.chrgText.cpMin);
- sci_target_end(doc->editor->scintilla, ttf.chrgText.cpMax);
- sci_target_replace(doc->editor->scintilla, filename, FALSE);
+ sci_target_start(doc->editor->sci, ttf.chrgText.cpMin);
+ sci_target_end(doc->editor->sci, ttf.chrgText.cpMax);
+ sci_target_replace(doc->editor->sci, filename, FALSE);
}
g_free(filebase);
@@ -1305,7 +1305,7 @@
/* don't read over the doc length */
gint max_len = MIN((gint)bytes_read + 6, (gint)*len - 1);
context = g_malloc(7); /* read 6 bytes from Sci + '\0' */
- sci_get_text_range(doc->editor->scintilla, bytes_read, max_len, context);
+ sci_get_text_range(doc->editor->sci, bytes_read, max_len, context);
/* take only one valid Unicode character from the context and discard the leftover */
unic = g_utf8_get_char_validated(context, -1);
@@ -1410,7 +1410,7 @@
if (file_prefs.final_new_line)
editor_ensure_final_newline(doc);
- len = sci_get_length(doc->editor->scintilla) + 1;
+ len = sci_get_length(doc->editor->sci) + 1;
if (doc->has_bom && encodings_is_unicode_charset(doc->encoding))
{ /* always write a UTF-8 BOM because in this moment the text itself is still in UTF-8
* encoding, it will be converted to doc->encoding below and this conversion
@@ -1419,13 +1419,13 @@
data[0] = (gchar) 0xef;
data[1] = (gchar) 0xbb;
data[2] = (gchar) 0xbf;
- sci_get_text(doc->editor->scintilla, len, data + 3);
+ sci_get_text(doc->editor->sci, len, data + 3);
len += 3;
}
else
{
data = (gchar*) g_malloc(len);
- sci_get_text(doc->editor->scintilla, len, data);
+ sci_get_text(doc->editor->sci, len, data);
}
/* save in original encoding, skip when it is already UTF-8 or has the encoding "None" */
@@ -1470,8 +1470,8 @@
/* set line numbers again, to reset the margin width, if
* there are more lines than before */
- sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
- sci_set_savepoint(doc->editor->scintilla);
+ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
+ sci_set_savepoint(doc->editor->sci);
/* stat the file to get the timestamp, otherwise on Windows the actual
* timestamp can be ahead of time(NULL) */
@@ -1515,38 +1515,38 @@
if (! *text)
return TRUE;
- start_pos = (inc) ? sci_get_selection_start(doc->editor->scintilla) :
- sci_get_selection_end(doc->editor->scintilla); /* equal if no selection */
+ start_pos = (inc) ? sci_get_selection_start(doc->editor->sci) :
+ sci_get_selection_end(doc->editor->sci); /* equal if no selection */
/* search cursor to end */
ttf.chrg.cpMin = start_pos;
- ttf.chrg.cpMax = sci_get_length(doc->editor->scintilla);
+ ttf.chrg.cpMax = sci_get_length(doc->editor->sci);
ttf.lpstrText = (gchar *)text;
- search_pos = sci_find_text(doc->editor->scintilla, flags, &ttf);
+ search_pos = sci_find_text(doc->editor->sci, flags, &ttf);
/* if no match, search start to cursor */
if (search_pos == -1)
{
ttf.chrg.cpMin = 0;
ttf.chrg.cpMax = start_pos + strlen(text);
- search_pos = sci_find_text(doc->editor->scintilla, flags, &ttf);
+ search_pos = sci_find_text(doc->editor->sci, flags, &ttf);
}
if (search_pos != -1)
{
- gint line = sci_get_line_from_position(doc->editor->scintilla, ttf.chrgText.cpMin);
+ gint line = sci_get_line_from_position(doc->editor->sci, ttf.chrgText.cpMin);
/* unfold maybe folded results */
- sci_ensure_line_is_visible(doc->editor->scintilla, line);
+ sci_ensure_line_is_visible(doc->editor->sci, line);
- sci_set_selection_start(doc->editor->scintilla, ttf.chrgText.cpMin);
- sci_set_selection_end(doc->editor->scintilla, ttf.chrgText.cpMax);
+ sci_set_selection_start(doc->editor->sci, ttf.chrgText.cpMin);
+ sci_set_selection_end(doc->editor->sci, ttf.chrgText.cpMax);
- if (! editor_line_in_view(doc->editor->scintilla, line))
+ if (! editor_line_in_view(doc->editor->sci, line))
{ /* we need to force scrolling in case the cursor is outside of the current visible area
* GeanyDocument::scroll_percent doesn't work because sci isn't always updated
* while searching */
- editor_scroll_to_line(doc->editor->scintilla, -1, 0.3F);
+ editor_scroll_to_line(doc->editor->sci, -1, 0.3F);
}
return TRUE;
}
@@ -1557,7 +1557,7 @@
ui_set_statusbar(FALSE, _("\"%s\" was not found."), text);
}
utils_beep();
- sci_goto_pos(doc->editor->scintilla, start_pos, FALSE); /* clear selection */
+ sci_goto_pos(doc->editor->sci, start_pos, FALSE); /* clear selection */
return FALSE;
}
}
@@ -1577,33 +1577,33 @@
if (flags & SCFIND_REGEXP)
search_backwards = FALSE;
- selection_start = sci_get_selection_start(doc->editor->scintilla);
- selection_end = sci_get_selection_end(doc->editor->scintilla);
+ selection_start = sci_get_selection_start(doc->editor->sci);
+ selection_end = sci_get_selection_end(doc->editor->sci);
if ((selection_end - selection_start) > 0)
{ /* there's a selection so go to the end */
if (search_backwards)
- sci_goto_pos(doc->editor->scintilla, selection_start, TRUE);
+ sci_goto_pos(doc->editor->sci, selection_start, TRUE);
else
- sci_goto_pos(doc->editor->scintilla, selection_end, TRUE);
+ sci_goto_pos(doc->editor->sci, selection_end, TRUE);
}
- sci_set_search_anchor(doc->editor->scintilla);
+ sci_set_search_anchor(doc->editor->sci);
if (search_backwards)
- search_pos = sci_search_prev(doc->editor->scintilla, flags, text);
+ search_pos = sci_search_prev(doc->editor->sci, flags, text);
else
- search_pos = sci_search_next(doc->editor->scintilla, flags, text);
+ search_pos = sci_search_next(doc->editor->sci, flags, text);
if (search_pos != -1)
{
/* unfold maybe folded results */
- sci_ensure_line_is_visible(doc->editor->scintilla,
- sci_get_line_from_position(doc->editor->scintilla, search_pos));
+ sci_ensure_line_is_visible(doc->editor->sci,
+ sci_get_line_from_position(doc->editor->sci, search_pos));
if (scroll)
doc->editor->scroll_percent = 0.3F;
}
else
{
- gint sci_len = sci_get_length(doc->editor->scintilla);
+ gint sci_len = sci_get_length(doc->editor->sci);
/* if we just searched the whole text, give up searching. */
if ((selection_end == 0 && ! search_backwards) ||
@@ -1621,11 +1621,11 @@
{
gint ret;
- sci_set_current_position(doc->editor->scintilla, (search_backwards) ? sci_len : 0, FALSE);
+ sci_set_current_position(doc->editor->sci, (search_backwards) ? sci_len : 0, FALSE);
ret = document_find_text(doc, text, flags, search_backwards, scroll, parent);
if (ret == -1)
{ /* return to original cursor position if not found */
- sci_set_current_position(doc->editor->scintilla, selection_start, FALSE);
+ sci_set_current_position(doc->editor->sci, selection_start, FALSE);
}
return ret;
}
@@ -1648,8 +1648,8 @@
if (flags & SCFIND_REGEXP)
search_backwards = FALSE;
- selection_start = sci_get_selection_start(doc->editor->scintilla);
- selection_end = sci_get_selection_end(doc->editor->scintilla);
+ selection_start = sci_get_selection_start(doc->editor->sci);
+ selection_end = sci_get_selection_end(doc->editor->sci);
if (selection_end == selection_start)
{
/* no selection so just find the next match */
@@ -1659,9 +1659,9 @@
/* there's a selection so go to the start before finding to search through it
* this ensures there is a match */
if (search_backwards)
- sci_goto_pos(doc->editor->scintilla, selection_end, TRUE);
+ sci_goto_pos(doc->editor->sci, selection_end, TRUE);
else
- sci_goto_pos(doc->editor->scintilla, selection_start, TRUE);
+ sci_goto_pos(doc->editor->sci, selection_start, TRUE);
search_pos = document_find_text(doc, find_text, flags, search_backwards, TRUE, NULL);
/* return if the original selected text did not match (at the start of the selection) */
@@ -1672,11 +1672,11 @@
{
gint replace_len;
/* search next/prev will select matching text, which we use to set the replace target */
- sci_target_from_selection(doc->editor->scintilla);
- replace_len = sci_target_replace(doc->editor->scintilla, replace_text, flags & SCFIND_REGEXP);
+ sci_target_from_selection(doc->editor->sci);
+ replace_len = sci_target_replace(doc->editor->sci, replace_text, flags & SCFIND_REGEXP);
/* select the replacement - find text will skip past the selected text */
- sci_set_selection_start(doc->editor->scintilla, search_pos);
- sci_set_selection_end(doc->editor->scintilla, search_pos + replace_len);
+ sci_set_selection_start(doc->editor->sci, search_pos);
+ sci_set_selection_end(doc->editor->sci, search_pos + replace_len);
}
else
{
@@ -1741,7 +1741,7 @@
g_return_val_if_fail(doc != NULL && find_text != NULL && replace_text != NULL, 0);
if (! *find_text || doc->readonly) return 0;
- sci = doc->editor->scintilla;
+ sci = doc->editor->sci;
sci_start_undo_action(sci);
ttf.chrg.cpMin = start;
@@ -1815,8 +1815,8 @@
g_return_if_fail(doc != NULL && find_text != NULL && replace_text != NULL);
if (! *find_text) return;
- selection_start = sci_get_selection_start(doc->editor->scintilla);
- selection_end = sci_get_selection_end(doc->editor->scintilla);
+ selection_start = sci_get_selection_start(doc->editor->sci);
+ selection_end = sci_get_selection_end(doc->editor->sci);
/* do we have a selection? */
if ((selection_end - selection_start) == 0)
{
@@ -1824,24 +1824,24 @@
return;
}
- selection_mode = sci_get_selection_mode(doc->editor->scintilla);
- selected_lines = sci_get_lines_selected(doc->editor->scintilla);
+ selection_mode = sci_get_selection_mode(doc->editor->sci);
+ selected_lines = sci_get_lines_selected(doc->editor->sci);
/* handle rectangle, multi line selections (it doesn't matter on a single line) */
if (selection_mode == SC_SEL_RECTANGLE && selected_lines > 1)
{
gint first_line, line;
- sci_start_undo_action(doc->editor->scintilla);
+ sci_start_undo_action(doc->editor->sci);
- first_line = sci_get_line_from_position(doc->editor->scintilla, selection_start);
+ first_line = sci_get_line_from_position(doc->editor->sci, selection_start);
/* Find the last line with chars selected (not EOL char) */
- last_line = sci_get_line_from_position(doc->editor->scintilla,
+ last_line = sci_get_line_from_position(doc->editor->sci,
selection_end - editor_get_eol_char_len(doc));
last_line = MAX(first_line, last_line);
for (line = first_line; line < (first_line + selected_lines); line++)
{
- gint line_start = sci_get_pos_at_line_sel_start(doc->editor->scintilla, line);
- gint line_end = sci_get_pos_at_line_sel_end(doc->editor->scintilla, line);
+ gint line_start = sci_get_pos_at_line_sel_start(doc->editor->sci, line);
+ gint line_end = sci_get_pos_at_line_sel_end(doc->editor->sci, line);
/* skip line if there is no selection */
if (line_start != INVALID_POSITION)
@@ -1856,11 +1856,11 @@
replaced = TRUE;
/* this gets the greatest column within the selection after replacing */
max_column = MAX(max_column,
- new_sel_end - sci_get_position_from_line(doc->editor->scintilla, line));
+ new_sel_end - sci_get_position_from_line(doc->editor->sci, line));
}
}
}
- sci_end_undo_action(doc->editor->scintilla);
+ sci_end_undo_action(doc->editor->sci);
}
else /* handle normal line selection */
{
@@ -1876,26 +1876,26 @@
if (selection_mode == SC_SEL_RECTANGLE && selected_lines > 1)
{
/* now we can scroll to the selection and destroy it because we rebuild it later */
- /*sci_goto_pos(doc->editor->scintilla, selection_start, FALSE);*/
+ /*sci_goto_pos(doc->editor->sci, selection_start, FALSE);*/
/* Note: the selection will be wrapped to last_line + 1 if max_column is greater than
* the highest column on the last line. The wrapped selection is completely different
* from the original one, so skip the selection at all */
/* TODO is there a better way to handle the wrapped selection? */
- if ((sci_get_line_length(doc->editor->scintilla, last_line) - 1) >= max_column)
+ if ((sci_get_line_length(doc->editor->sci, last_line) - 1) >= max_column)
{ /* for keeping and adjusting the selection in multi line rectangle selection we
* need the last line of the original selection and the greatest column number after
* replacing and set the selection end to the last line at the greatest column */
- sci_set_selection_start(doc->editor->scintilla, selection_start);
- sci_set_selection_end(doc->editor->scintilla,
- sci_get_position_from_line(doc->editor->scintilla, last_line) + max_column);
- sci_set_selection_mode(doc->editor->scintilla, selection_mode);
+ sci_set_selection_start(doc->editor->sci, selection_start);
+ sci_set_selection_end(doc->editor->sci,
+ sci_get_position_from_line(doc->editor->sci, last_line) + max_column);
+ sci_set_selection_mode(doc->editor->sci, selection_mode);
}
}
else
{
- sci_set_selection_start(doc->editor->scintilla, selection_start);
- sci_set_selection_end(doc->editor->scintilla, selection_end);
+ sci_set_selection_start(doc->editor->sci, selection_start);
+ sci_set_selection_end(doc->editor->sci, selection_end);
}
}
else /* no replacements */
@@ -1913,7 +1913,7 @@
g_return_val_if_fail(doc != NULL && find_text != NULL && replace_text != NULL, FALSE);
if (! *find_text) return FALSE;
- len = sci_get_length(doc->editor->scintilla);
+ len = sci_get_length(doc->editor->sci);
count = document_replace_range(
doc, find_text, replace_text, flags, 0, len, TRUE, NULL);
@@ -2016,7 +2016,7 @@
gboolean ret = FALSE;
guint n;
const GString *s;
- ScintillaObject *sci = doc ? doc->editor->scintilla : NULL;
+ ScintillaObject *sci = doc ? doc->editor->sci : NULL;
if (sci != NULL && editor_lexer_get_type_keyword_idx(sci_get_lexer(sci)) == -1)
return FALSE;
@@ -2038,7 +2038,7 @@
{
if (documents[n]->is_valid)
{
- ScintillaObject *wid = documents[n]->editor->scintilla;
+ ScintillaObject *wid = documents[n]->editor->sci;
gint keyword_idx = editor_lexer_get_type_keyword_idx(sci_get_lexer(wid));
if (keyword_idx > 0)
@@ -2079,7 +2079,7 @@
tm_workspace_remove_object(doc->tm_file, TRUE, TRUE);
doc->tm_file = NULL;
}
- highlighting_set_styles(doc->editor->scintilla, type->id);
+ highlighting_set_styles(doc->editor->sci, type->id);
build_menu_update(doc);
queue_colourise(doc);
}
@@ -2192,7 +2192,7 @@
if (doc == NULL)
return FALSE;
- if (g_trash_stack_height(&fdoc->undo_actions) > 0 || sci_can_undo(doc->editor->scintilla))
+ if (g_trash_stack_height(&fdoc->undo_actions) > 0 || sci_can_undo(doc->editor->sci))
return TRUE;
else
return FALSE;
@@ -2204,7 +2204,7 @@
Document *fdoc = DOCUMENT(doc);
doc->changed =
- (sci_is_modified(doc->editor->scintilla) ||
+ (sci_is_modified(doc->editor->sci) ||
doc->has_bom != fdoc->saved_encoding.has_bom ||
! utils_str_equal(doc->encoding, fdoc->saved_encoding.encoding));
document_set_text_changed(doc, doc->changed);
@@ -2225,7 +2225,7 @@
{
/* fallback, should not be necessary */
geany_debug("%s: fallback used", __func__);
- sci_undo(doc->editor->scintilla);
+ sci_undo(doc->editor->sci);
}
else
{
@@ -2235,7 +2235,7 @@
{
document_redo_add(doc, UNDO_SCINTILLA, NULL);
- sci_undo(doc->editor->scintilla);
+ sci_undo(doc->editor->sci);
break;
}
case UNDO_BOM:
@@ -2279,7 +2279,7 @@
if (doc == NULL)
return FALSE;
- if (g_trash_stack_height(&fdoc->redo_actions) > 0 || sci_can_redo(doc->editor->scintilla))
+ if (g_trash_stack_height(&fdoc->redo_actions) > 0 || sci_can_redo(doc->editor->sci))
return TRUE;
else
return FALSE;
@@ -2300,7 +2300,7 @@
{
/* fallback, should not be necessary */
geany_debug("%s: fallback used", __func__);
- sci_redo(doc->editor->scintilla);
+ sci_redo(doc->editor->sci);
}
else
{
@@ -2310,7 +2310,7 @@
{
document_undo_add(doc, UNDO_SCINTILLA, NULL);
- sci_redo(doc->editor->scintilla);
+ sci_redo(doc->editor->sci);
break;
}
case UNDO_BOM:
@@ -2402,9 +2402,9 @@
gchar *text;
GeanyDocument *doc;
- len = sci_get_length(old_doc->editor->scintilla) + 1;
+ len = sci_get_length(old_doc->editor->sci) + 1;
text = (gchar*) g_malloc(len);
- sci_get_text(old_doc->editor->scintilla, len, text);
+ sci_get_text(old_doc->editor->sci, len, text);
/* use old file type (or maybe NULL for auto detect would be better?) */
doc = document_new_file(utf8_filename, old_doc->file_type, text);
g_free(text);
@@ -2414,8 +2414,8 @@
doc->readonly = old_doc->readonly;
doc->has_bom = old_doc->has_bom;
document_set_encoding(doc, old_doc->encoding);
- sci_set_lines_wrapped(doc->editor->scintilla, doc->editor->line_wrapping);
- sci_set_readonly(doc->editor->scintilla, doc->readonly);
+ sci_set_lines_wrapped(doc->editor->sci, doc->editor->line_wrapping);
+ sci_set_readonly(doc->editor->sci, doc->readonly);
ui_document_show_hide(doc);
return doc;
Modified: branches/editor-struct/src/editor.c
===================================================================
--- branches/editor-struct/src/editor.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/src/editor.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -180,20 +180,20 @@
if (doc == NULL)
return FALSE;
- editor_info.click_pos = sci_get_position_from_xy(doc->editor->scintilla, (gint)event->x, (gint)event->y, FALSE);
+ editor_info.click_pos = sci_get_position_from_xy(doc->editor->sci, (gint)event->x, (gint)event->y, FALSE);
if (event->button == 1)
{
if (GDK_BUTTON_PRESS == event->type && editor_prefs.disable_dnd)
{
- gint ss = sci_get_selection_start(doc->editor->scintilla);
- sci_set_selection_end(doc->editor->scintilla, ss);
+ gint ss = sci_get_selection_start(doc->editor->sci);
+ sci_set_selection_end(doc->editor->sci, ss);
}
return document_check_disk_status(doc, FALSE);
}
if (event->button == 3)
{
- editor_find_current_word(doc->editor->scintilla, editor_info.click_pos,
+ editor_find_current_word(doc->editor->sci, editor_info.click_pos,
current_word, sizeof current_word, NULL);
ui_update_popup_goto_items((current_word[0] != '\0') ? TRUE : FALSE);
@@ -264,7 +264,7 @@
gint line = sci_get_line_from_position(sci, nt->position);
gboolean set = sci_is_marker_set_at_line(sci, line, 1);
- /*sci_marker_delete_all(doc->editor->scintilla, 1);*/
+ /*sci_marker_delete_all(doc->editor->sci, 1);*/
sci_set_marker_at_line(sci, line, ! set, 1); /* toggle the marker */
}
/* left click on the folding margin to toggle folding state of current line */
@@ -277,7 +277,7 @@
static void on_update_ui(GeanyEditor *editor, G_GNUC_UNUSED SCNotification *nt)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
gint pos = sci_get_current_position(sci);
/* undo / redo menu update */
@@ -316,7 +316,7 @@
static void check_line_breaking(GeanyEditor *editor, gint pos, gchar c)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
gint line, lstart;
if (!editor->line_breaking)
@@ -371,7 +371,7 @@
static void on_char_added(GeanyEditor *editor, SCNotification *nt)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
gint pos = sci_get_current_position(sci);
switch (nt->ch)
@@ -575,7 +575,7 @@
GeanyEditor *editor;
editor = doc->editor;
- sci = editor->scintilla;
+ sci = editor->sci;
nt = lscn;
switch (nt->nmhdr.code)
@@ -725,7 +725,7 @@
static void check_python_indent(GeanyEditor *editor, gint pos)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
gint last_char = pos - editor_get_eol_char_len(editor->document) - 1;
/* add extra indentation for Python after colon */
@@ -743,7 +743,7 @@
static void on_new_line_added(GeanyEditor *editor)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
gint pos = sci_get_current_position(sci);
gint line = sci_get_current_line(sci);
@@ -819,7 +819,7 @@
* and ignore the case of editor_close_block */
static void get_indent(GeanyEditor *editor, gint pos, gboolean use_this_line)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
guint i, len, j = 0;
gint prev_line;
gchar *linebuf;
@@ -942,7 +942,7 @@
if (doc == NULL || doc->file_type == NULL)
return;
- sci = doc->editor->scintilla;
+ sci = doc->editor->sci;
if (! lexer_has_braces(sci))
return;
@@ -1201,7 +1201,7 @@
if (doc == NULL || doc->file_type == NULL)
return FALSE;
- sci = doc->editor->scintilla;
+ sci = doc->editor->sci;
lexer = SSM(sci, SCI_GETLEXER, 0, 0);
@@ -1285,7 +1285,7 @@
if (doc == NULL || doc->file_type == NULL)
return FALSE;
- sci = doc->editor->scintilla;
+ sci = doc->editor->sci;
tags = tm_workspace_find(root, tm_tag_max_t, attrs, TRUE, doc->file_type->lang);
if (NULL != tags && tags->len > 0)
@@ -1339,7 +1339,7 @@
doc == NULL || doc->file_type == NULL)
return FALSE;
- sci = doc->editor->scintilla;
+ sci = doc->editor->sci;
ft = doc->file_type;
line = sci_get_line_from_position(sci, pos);
@@ -1400,7 +1400,7 @@
if (doc == NULL || doc->file_type == NULL)
return;
- sci = doc->editor->scintilla;
+ sci = doc->editor->sci;
if (sci_get_char_at(sci, pos - 2) == '}')
{
@@ -1531,7 +1531,7 @@
gint step, str_len;
gint ft_id = FILETYPE_ID(editor->document->file_type);
GHashTable *specials;
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
str = g_strdup(word);
g_strstrip(str);
@@ -1619,7 +1619,7 @@
if (doc == NULL)
return FALSE;
- sci = doc->editor->scintilla;
+ sci = doc->editor->sci;
/* return if we are editing an existing line (chars on right of cursor) */
if (! editor_prefs.complete_snippets_whilst_editing && ! at_eol(sci, pos))
return FALSE;
@@ -1661,7 +1661,7 @@
static void insert_closing_tag(GeanyEditor *editor, gint pos, gchar ch, const gchar *tag_name)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
gchar *to_insert = NULL;
if (ch == '/')
@@ -1697,7 +1697,7 @@
*/
static gboolean handle_xml(GeanyEditor *editor, gchar ch)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
gint lexer = SSM(sci, SCI_GETLEXER, 0, 0);
gint pos, min;
gchar *str_found, sel[512];
@@ -1764,7 +1764,7 @@
static void auto_table(GeanyEditor *editor, gint pos)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
gchar *table;
gint indent_pos;
@@ -1809,9 +1809,9 @@
str_end = g_strdup_printf("%s%s", doc->file_type->comment_close, eol);
/* insert the comment strings */
- sci_insert_text(doc->editor->scintilla, line_start, str_begin);
- line_len = sci_get_position_from_line(doc->editor->scintilla, last_line + 2);
- sci_insert_text(doc->editor->scintilla, line_len, str_end);
+ sci_insert_text(doc->editor->sci, line_start, str_begin);
+ line_len = sci_get_position_from_line(doc->editor->sci, last_line + 2);
+ sci_insert_text(doc->editor->sci, line_len, str_end);
g_free(str_begin);
g_free(str_end);
@@ -1829,28 +1829,28 @@
/* remove comment open chars */
pos = document_find_text(doc, doc->file_type->comment_open, 0, TRUE, FALSE, NULL);
- SSM(doc->editor->scintilla, SCI_DELETEBACK, 0, 0);
+ SSM(doc->editor->sci, SCI_DELETEBACK, 0, 0);
/* check whether the line is empty and can be deleted */
- line = sci_get_line_from_position(doc->editor->scintilla, pos);
- len = sci_get_line_length(doc->editor->scintilla, line);
- linebuf = sci_get_line(doc->editor->scintilla, line);
+ line = sci_get_line_from_position(doc->editor->sci, pos);
+ len = sci_get_line_length(doc->editor->sci, line);
+ linebuf = sci_get_line(doc->editor->sci, line);
x = 0;
while (linebuf[x] != '\0' && isspace(linebuf[x])) x++;
- if (x == len) SSM(doc->editor->scintilla, SCI_LINEDELETE, 0, 0);
+ if (x == len) SSM(doc->editor->sci, SCI_LINEDELETE, 0, 0);
g_free(linebuf);
/* remove comment close chars */
pos = document_find_text(doc, doc->file_type->comment_close, 0, FALSE, FALSE, NULL);
- SSM(doc->editor->scintilla, SCI_DELETEBACK, 0, 0);
+ SSM(doc->editor->sci, SCI_DELETEBACK, 0, 0);
/* check whether the line is empty and can be deleted */
- line = sci_get_line_from_position(doc->editor->scintilla, pos);
- len = sci_get_line_length(doc->editor->scintilla, line);
- linebuf = sci_get_line(doc->editor->scintilla, line);
+ line = sci_get_line_from_position(doc->editor->sci, pos);
+ len = sci_get_line_length(doc->editor->sci, line);
+ linebuf = sci_get_line(doc->editor->sci, line);
x = 0;
while (linebuf[x] != '\0' && isspace(linebuf[x])) x++;
- if (x == len) SSM(doc->editor->scintilla, SCI_LINEDELETE, 0, 0);
+ if (x == len) SSM(doc->editor->sci, SCI_LINEDELETE, 0, 0);
g_free(linebuf);
}
@@ -1874,29 +1874,29 @@
if (line < 0)
{ /* use selection or current line */
- sel_start = sci_get_selection_start(doc->editor->scintilla);
- sel_end = sci_get_selection_end(doc->editor->scintilla);
+ sel_start = sci_get_selection_start(doc->editor->sci);
+ sel_end = sci_get_selection_end(doc->editor->sci);
- first_line = sci_get_line_from_position(doc->editor->scintilla, sel_start);
+ first_line = sci_get_line_from_position(doc->editor->sci, sel_start);
/* Find the last line with chars selected (not EOL char) */
- last_line = sci_get_line_from_position(doc->editor->scintilla,
+ last_line = sci_get_line_from_position(doc->editor->sci,
sel_end - editor_get_eol_char_len(doc));
last_line = MAX(first_line, last_line);
}
else
{
first_line = last_line = line;
- sel_start = sel_end = sci_get_position_from_line(doc->editor->scintilla, line);
+ sel_start = sel_end = sci_get_position_from_line(doc->editor->sci, line);
}
ft = doc->file_type;
/* detection of HTML vs PHP code, if non-PHP set filetype to XML */
- line_start = sci_get_position_from_line(doc->editor->scintilla, first_line);
+ line_start = sci_get_position_from_line(doc->editor->sci, first_line);
if (ft->id == GEANY_FILETYPES_PHP)
{
- if (sci_get_style_at(doc->editor->scintilla, line_start) < 118 ||
- sci_get_style_at(doc->editor->scintilla, line_start) > 127)
+ if (sci_get_style_at(doc->editor->sci, line_start) < 118 ||
+ sci_get_style_at(doc->editor->sci, line_start) > 127)
ft = filetypes[GEANY_FILETYPES_XML];
}
@@ -1909,20 +1909,20 @@
if (co_len == 0)
return 0;
- SSM(doc->editor->scintilla, SCI_BEGINUNDOACTION, 0, 0);
+ SSM(doc->editor->sci, SCI_BEGINUNDOACTION, 0, 0);
for (i = first_line; (i <= last_line) && (! break_loop); i++)
{
gint buf_len;
- line_start = sci_get_position_from_line(doc->editor->scintilla, i);
- line_len = sci_get_line_length(doc->editor->scintilla, i);
+ line_start = sci_get_position_from_line(doc->editor->sci, i);
+ line_len = sci_get_line_length(doc->editor->sci, i);
x = 0;
buf_len = MIN((gint)sizeof(sel) - 1, line_len - 1);
if (buf_len <= 0)
continue;
- sci_get_text_range(doc->editor->scintilla, line_start, line_start + buf_len, sel);
+ sci_get_text_range(doc->editor->sci, line_start, line_start + buf_len, sel);
sel[buf_len] = '\0';
while (isspace(sel[x])) x++;
@@ -1951,15 +1951,15 @@
continue;
}
- SSM(doc->editor->scintilla, SCI_SETSEL, line_start + x, line_start + x + co_len);
- sci_replace_sel(doc->editor->scintilla, "");
+ SSM(doc->editor->sci, SCI_SETSEL, line_start + x, line_start + x + co_len);
+ sci_replace_sel(doc->editor->sci, "");
count++;
}
/* use multi line comment */
else
{
gint style_comment;
- gint lexer = SSM(doc->editor->scintilla, SCI_GETLEXER, 0, 0);
+ gint lexer = SSM(doc->editor->sci, SCI_GETLEXER, 0, 0);
/* process only lines which are already comments */
switch (lexer)
@@ -1967,8 +1967,8 @@
case SCLEX_XML:
case SCLEX_HTML:
{
- if (sci_get_style_at(doc->editor->scintilla, line_start) >= 118 &&
- sci_get_style_at(doc->editor->scintilla, line_start) <= 127)
+ if (sci_get_style_at(doc->editor->sci, line_start) >= 118 &&
+ sci_get_style_at(doc->editor->sci, line_start) <= 127)
style_comment = SCE_HPHP_COMMENT;
else style_comment = SCE_H_COMMENT;
break;
@@ -1979,7 +1979,7 @@
case SCLEX_D: style_comment = SCE_D_COMMENT; break;
default: style_comment = SCE_C_COMMENT;
}
- if (sci_get_style_at(doc->editor->scintilla, line_start + x) == style_comment)
+ if (sci_get_style_at(doc->editor->sci, line_start + x) == style_comment)
{
real_uncomment_multiline(doc);
count = 1;
@@ -1991,7 +1991,7 @@
}
}
}
- SSM(doc->editor->scintilla, SCI_ENDUNDOACTION, 0, 0);
+ SSM(doc->editor->sci, SCI_ENDUNDOACTION, 0, 0);
/* restore selection if there is one
* but don't touch the selection if caller is editor_do_comment_toggle */
@@ -1999,14 +1999,14 @@
{
if (single_line)
{
- sci_set_selection_start(doc->editor->scintilla, sel_start - co_len);
- sci_set_selection_end(doc->editor->scintilla, sel_end - (count * co_len));
+ sci_set_selection_start(doc->editor->sci, sel_start - co_len);
+ sci_set_selection_end(doc->editor->sci, sel_end - (count * co_len));
}
else
{
gint eol_len = editor_get_eol_char_len(doc);
- sci_set_selection_start(doc->editor->scintilla, sel_start - co_len - eol_len);
- sci_set_selection_end(doc->editor->scintilla, sel_end - co_len - eol_len);
+ sci_set_selection_start(doc->editor->sci, sel_start - co_len - eol_len);
+ sci_set_selection_end(doc->editor->sci, sel_end - co_len - eol_len);
}
}
@@ -2030,24 +2030,24 @@
if (doc == NULL || doc->file_type == NULL)
return;
- sel_start = sci_get_selection_start(doc->editor->scintilla);
- sel_end = sci_get_selection_end(doc->editor->scintilla);
+ sel_start = sci_get_selection_start(doc->editor->sci);
+ sel_end = sci_get_selection_end(doc->editor->sci);
ft = doc->file_type;
- first_line = sci_get_line_from_position(doc->editor->scintilla,
- sci_get_selection_start(doc->editor->scintilla));
+ first_line = sci_get_line_from_position(doc->editor->sci,
+ sci_get_selection_start(doc->editor->sci));
/* Find the last line with chars selected (not EOL char) */
- last_line = sci_get_line_from_position(doc->editor->scintilla,
- sci_get_selection_end(doc->editor->scintilla) - editor_get_eol_char_len(doc));
+ last_line = sci_get_line_from_position(doc->editor->sci,
+ sci_get_selection_end(doc->editor->sci) - editor_get_eol_char_len(doc));
last_line = MAX(first_line, last_line);
/* detection of HTML vs PHP code, if non-PHP set filetype to XML */
- first_line_start = sci_get_position_from_line(doc->editor->scintilla, first_line);
+ first_line_start = sci_get_position_from_line(doc->editor->sci, first_line);
if (ft->id == GEANY_FILETYPES_PHP)
{
- if (sci_get_style_at(doc->editor->scintilla, first_line_start) < 118 ||
- sci_get_style_at(doc->editor->scintilla, first_line_start) > 127)
+ if (sci_get_style_at(doc->editor->sci, first_line_start) < 118 ||
+ sci_get_style_at(doc->editor->sci, first_line_start) > 127)
ft = filetypes[GEANY_FILETYPES_XML];
}
@@ -2060,20 +2060,20 @@
if (co_len == 0)
return;
- SSM(doc->editor->scintilla, SCI_BEGINUNDOACTION, 0, 0);
+ SSM(doc->editor->sci, SCI_BEGINUNDOACTION, 0, 0);
for (i = first_line; (i <= last_line) && (! break_loop); i++)
{
gint buf_len;
- line_start = sci_get_position_from_line(doc->editor->scintilla, i);
- line_len = sci_get_line_length(doc->editor->scintilla, i);
+ line_start = sci_get_position_from_line(doc->editor->sci, i);
+ line_len = sci_get_line_length(doc->editor->sci, i);
x = 0;
buf_len = MIN((gint)sizeof(sel) - 1, line_len - 1);
if (buf_len < 0)
continue;
- sci_get_text_range(doc->editor->scintilla, line_start, line_start + buf_len, sel);
+ sci_get_text_range(doc->editor->sci, line_start, line_start + buf_len, sel);
sel[buf_len] = '\0';
while (isspace(sel[x])) x++;
@@ -2107,7 +2107,7 @@
else
{
gint style_comment;
- gint lexer = SSM(doc->editor->scintilla, SCI_GETLEXER, 0, 0);
+ gint lexer = SSM(doc->editor->sci, SCI_GETLEXER, 0, 0);
/* skip lines which are already comments */
switch (lexer)
@@ -2115,8 +2115,8 @@
case SCLEX_XML:
case SCLEX_HTML:
{
- if (sci_get_style_at(doc->editor->scintilla, line_start) >= 118 &&
- sci_get_style_at(doc->editor->scintilla, line_start) <= 127)
+ if (sci_get_style_at(doc->editor->sci, line_start) >= 118 &&
+ sci_get_style_at(doc->editor->sci, line_start) <= 127)
style_comment = SCE_HPHP_COMMENT;
else style_comment = SCE_H_COMMENT;
break;
@@ -2129,7 +2129,7 @@
case SCLEX_PERL: style_comment = SCE_PL_POD; break;
default: style_comment = SCE_C_COMMENT;
}
- if (sci_get_style_at(doc->editor->scintilla, line_start + x) == style_comment)
+ if (sci_get_style_at(doc->editor->sci, line_start + x) == style_comment)
{
real_uncomment_multiline(doc);
count_uncommented++;
@@ -2146,7 +2146,7 @@
}
}
- SSM(doc->editor->scintilla, SCI_ENDUNDOACTION, 0, 0);
+ SSM(doc->editor->sci, SCI_ENDUNDOACTION, 0, 0);
co_len += tm_len;
@@ -2162,8 +2162,8 @@
if ((sel_start - first_line_start) <= (gint) strlen(indent))
a = 0;
- sci_set_selection_start(doc->editor->scintilla, sel_start + a);
- sci_set_selection_end(doc->editor->scintilla, sel_end +
+ sci_set_selection_start(doc->editor->sci, sel_start + a);
+ sci_set_selection_end(doc->editor->sci, sel_end +
(count_commented * co_len) - (count_uncommented * co_len));
}
else
@@ -2171,19 +2171,19 @@
gint eol_len = editor_get_eol_char_len(doc);
if (count_uncommented > 0)
{
- sci_set_selection_start(doc->editor->scintilla, sel_start - co_len - eol_len);
- sci_set_selection_end(doc->editor->scintilla, sel_end - co_len - eol_len);
+ sci_set_selection_start(doc->editor->sci, sel_start - co_len - eol_len);
+ sci_set_selection_end(doc->editor->sci, sel_end - co_len - eol_len);
}
else
{
- sci_set_selection_start(doc->editor->scintilla, sel_start + co_len + eol_len);
- sci_set_selection_end(doc->editor->scintilla, sel_end + co_len + eol_len);
+ sci_set_selection_start(doc->editor->sci, sel_start + co_len + eol_len);
+ sci_set_selection_end(doc->editor->sci, sel_end + co_len + eol_len);
}
}
}
else if (count_uncommented > 0)
{
- sci_set_current_position(doc->editor->scintilla, sel_start - co_len, TRUE);
+ sci_set_current_position(doc->editor->sci, sel_start - co_len, TRUE);
}
}
@@ -2203,29 +2203,29 @@
if (line < 0)
{ /* use selection or current line */
- sel_start = sci_get_selection_start(doc->editor->scintilla);
- sel_end = sci_get_selection_end(doc->editor->scintilla);
+ sel_start = sci_get_selection_start(doc->editor->sci);
+ sel_end = sci_get_selection_end(doc->editor->sci);
- first_line = sci_get_line_from_position(doc->editor->scintilla, sel_start);
+ first_line = sci_get_line_from_position(doc->editor->sci, sel_start);
/* Find the last line with chars selected (not EOL char) */
- last_line = sci_get_line_from_position(doc->editor->scintilla,
+ last_line = sci_get_line_from_position(doc->editor->sci,
sel_end - editor_get_eol_char_len(doc));
last_line = MAX(first_line, last_line);
}
else
{
first_line = last_line = line;
- sel_start = sel_end = sci_get_position_from_line(doc->editor->scintilla, line);
+ sel_start = sel_end = sci_get_position_from_line(doc->editor->sci, line);
}
ft = doc->file_type;
/* detection of HTML vs PHP code, if non-PHP set filetype to XML */
- line_start = sci_get_position_from_line(doc->editor->scintilla, first_line);
+ line_start = sci_get_position_from_line(doc->editor->sci, first_line);
if (ft->id == GEANY_FILETYPES_PHP)
{
- if (sci_get_style_at(doc->editor->scintilla, line_start) < 118 ||
- sci_get_style_at(doc->editor->scintilla, line_start) > 127)
+ if (sci_get_style_at(doc->editor->sci, line_start) < 118 ||
+ sci_get_style_at(doc->editor->sci, line_start) > 127)
ft = filetypes[GEANY_FILETYPES_XML];
}
@@ -2238,20 +2238,20 @@
if (co_len == 0)
return;
- SSM(doc->editor->scintilla, SCI_BEGINUNDOACTION, 0, 0);
+ SSM(doc->editor->sci, SCI_BEGINUNDOACTION, 0, 0);
for (i = first_line; (i <= last_line) && (! break_loop); i++)
{
gint buf_len;
- line_start = sci_get_position_from_line(doc->editor->scintilla, i);
- line_len = sci_get_line_length(doc->editor->scintilla, i);
+ line_start = sci_get_position_from_line(doc->editor->sci, i);
+ line_len = sci_get_line_length(doc->editor->sci, i);
x = 0;
buf_len = MIN((gint)sizeof(sel) - 1, line_len - 1);
if (buf_len < 0)
continue;
- sci_get_text_range(doc->editor->scintilla, line_start, line_start + buf_len, sel);
+ sci_get_text_range(doc->editor->sci, line_start, line_start + buf_len, sel);
sel[buf_len] = '\0';
while (isspace(sel[x])) x++;
@@ -2271,17 +2271,17 @@
if (toggle)
{
gchar *text = g_strconcat(co, GEANY_TOGGLE_MARK, NULL);
- sci_insert_text(doc->editor->scintilla, start, text);
+ sci_insert_text(doc->editor->sci, start, text);
g_free(text);
}
else
- sci_insert_text(doc->editor->scintilla, start, co);
+ sci_insert_text(doc->editor->sci, start, co);
}
/* use multi line comment */
else
{
gint style_comment;
- gint lexer = SSM(doc->editor->scintilla, SCI_GETLEXER, 0, 0);
+ gint lexer = SSM(doc->editor->sci, SCI_GETLEXER, 0, 0);
/* skip lines which are already comments */
switch (lexer)
@@ -2289,8 +2289,8 @@
case SCLEX_XML:
case SCLEX_HTML:
{
- if (sci_get_style_at(doc->editor->scintilla, line_start) >= 118 &&
- sci_get_style_at(doc->editor->scintilla, line_start) <= 127)
+ if (sci_get_style_at(doc->editor->sci, line_start) >= 118 &&
+ sci_get_style_at(doc->editor->sci, line_start) <= 127)
style_comment = SCE_HPHP_COMMENT;
else style_comment = SCE_H_COMMENT;
break;
@@ -2301,7 +2301,7 @@
case SCLEX_D: style_comment = SCE_D_COMMENT; break;
default: style_comment = SCE_C_COMMENT;
}
- if (sci_get_style_at(doc->editor->scintilla, line_start + x) == style_comment) continue;
+ if (sci_get_style_at(doc->editor->sci, line_start + x) == style_comment) continue;
real_comment_multiline(doc, line_start, last_line);
@@ -2311,7 +2311,7 @@
}
}
}
- SSM(doc->editor->scintilla, SCI_ENDUNDOACTION, 0, 0);
+ SSM(doc->editor->sci, SCI_ENDUNDOACTION, 0, 0);
/* restore selection if there is one
* but don't touch the selection if caller is editor_do_comment_toggle */
@@ -2319,14 +2319,14 @@
{
if (single_line)
{
- sci_set_selection_start(doc->editor->scintilla, sel_start + co_len);
- sci_set_selection_end(doc->editor->scintilla, sel_end + ((i - first_line) * co_len));
+ sci_set_selection_start(doc->editor->sci, sel_start + co_len);
+ sci_set_selection_end(doc->editor->sci, sel_end + ((i - first_line) * co_len));
}
else
{
gint eol_len = editor_get_eol_char_len(doc);
- sci_set_selection_start(doc->editor->scintilla, sel_start + co_len + eol_len);
- sci_set_selection_end(doc->editor->scintilla, sel_end + co_len + eol_len);
+ sci_set_selection_start(doc->editor->sci, sel_start + co_len + eol_len);
+ sci_set_selection_end(doc->editor->sci, sel_end + co_len + eol_len);
}
}
}
@@ -2368,7 +2368,7 @@
static void auto_multiline(GeanyEditor *editor, gint pos)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
gint eol_len = editor_get_eol_char_len(editor->document);
gint style = SSM(sci, SCI_GETSTYLEAT, pos - 1 - eol_len, 0);
gint lexer = SSM(sci, SCI_GETLEXER, 0, 0);
@@ -2657,8 +2657,8 @@
have_multiline_comment = TRUE;
/* insert three lines one line above of the current position */
- line = sci_get_line_from_position(editor->scintilla, editor_info.click_pos);
- pos = sci_get_position_from_line(editor->scintilla, line);
+ line = sci_get_line_from_position(editor->sci, editor_info.click_pos);
+ pos = sci_get_position_from_line(editor->sci, line);
/* use the indent on the current line but only when comment indentation is used
* and we don't have multi line comment characters */
@@ -2674,13 +2674,13 @@
text = g_strdup("\n\n\n");
text_len = 3;
}
- sci_insert_text(editor->scintilla, pos, text);
+ sci_insert_text(editor->sci, pos, text);
g_free(text);
/* select the inserted lines for commenting */
- sci_set_selection_start(editor->scintilla, pos);
- sci_set_selection_end(editor->scintilla, pos + text_len);
+ sci_set_selection_start(editor->sci, pos);
+ sci_set_selection_end(editor->sci, pos + text_len);
editor_do_comment(doc, -1, TRUE, FALSE);
@@ -2693,9 +2693,9 @@
else
pos += strlen(indent);
- sci_set_current_position(editor->scintilla, pos, TRUE);
+ sci_set_current_position(editor->sci, pos, TRUE);
/* reset the selection */
- sci_set_anchor(editor->scintilla, pos);
+ sci_set_anchor(editor->sci, pos);
}
@@ -2729,7 +2729,7 @@
{
/* creates and inserts one tab or whitespace of the amount of the tab width */
gchar *text = get_whitespace(editor_prefs.tab_width, ! editor->use_tabs);
- sci_add_text(editor->scintilla, text);
+ sci_add_text(editor->sci, text);
g_free(text);
}
@@ -2870,18 +2870,18 @@
{
/* skip the first line or if the indentation of the previous and current line are equal */
if (i == 0 ||
- SSM(doc->editor->scintilla, SCI_GETLINEINDENTATION, i - 1, 0) ==
- SSM(doc->editor->scintilla, SCI_GETLINEINDENTATION, i, 0))
+ SSM(doc->editor->sci, SCI_GETLINEINDENTATION, i - 1, 0) ==
+ SSM(doc->editor->sci, SCI_GETLINEINDENTATION, i, 0))
continue;
- sel_start = SSM(doc->editor->scintilla, SCI_POSITIONFROMLINE, i, 0);
- sel_end = SSM(doc->editor->scintilla, SCI_GETLINEINDENTPOSITION, i, 0);
+ sel_start = SSM(doc->editor->sci, SCI_POSITIONFROMLINE, i, 0);
+ sel_end = SSM(doc->editor->sci, SCI_GETLINEINDENTPOSITION, i, 0);
if (sel_start < sel_end)
{
- SSM(doc->editor->scintilla, SCI_SETSEL, sel_start, sel_end);
- sci_replace_sel(doc->editor->scintilla, "");
+ SSM(doc->editor->sci, SCI_SETSEL, sel_start, sel_end);
+ sci_replace_sel(doc->editor->sci, "");
}
- sci_insert_text(doc->editor->scintilla, sel_start, indent);
+ sci_insert_text(doc->editor->sci, sel_start, indent);
}
}
@@ -2895,7 +2895,7 @@
g_return_if_fail(doc != NULL);
- sci = doc->editor->scintilla;
+ sci = doc->editor->sci;
first_sel_start = sci_get_selection_start(sci);
first_sel_end = sci_get_selection_end(sci);
@@ -2943,33 +2943,33 @@
g_return_if_fail(doc != NULL);
- sel_start = sci_get_selection_start(doc->editor->scintilla);
- sel_end = sci_get_selection_end(doc->editor->scintilla);
+ sel_start = sci_get_selection_start(doc->editor->sci);
+ sel_end = sci_get_selection_end(doc->editor->sci);
- first_line = sci_get_line_from_position(doc->editor->scintilla, sel_start);
+ first_line = sci_get_line_from_position(doc->editor->sci, sel_start);
/* Find the last line with chars selected (not EOL char) */
- last_line = sci_get_line_from_position(doc->editor->scintilla, sel_end - editor_get_eol_char_len(doc));
+ last_line = sci_get_line_from_position(doc->editor->sci, sel_end - editor_get_eol_char_len(doc));
last_line = MAX(first_line, last_line);
if (pos == -1)
pos = sel_start;
- SSM(doc->editor->scintilla, SCI_BEGINUNDOACTION, 0, 0);
+ SSM(doc->editor->sci, SCI_BEGINUNDOACTION, 0, 0);
for (i = first_line; i <= last_line; i++)
{
- indentation_end = SSM(doc->editor->scintilla, SCI_GETLINEINDENTPOSITION, i, 0);
+ indentation_end = SSM(doc->editor->sci, SCI_GETLINEINDENTPOSITION, i, 0);
if (decrease)
{
- line_start = SSM(doc->editor->scintilla, SCI_POSITIONFROMLINE, i, 0);
+ line_start = SSM(doc->editor->sci, SCI_POSITIONFROMLINE, i, 0);
/* searching backwards for a space to remove */
- while (sci_get_char_at(doc->editor->scintilla, indentation_end) != ' ' && indentation_end > line_start)
+ while (sci_get_char_at(doc->editor->sci, indentation_end) != ' ' && indentation_end > line_start)
indentation_end--;
- if (sci_get_char_at(doc->editor->scintilla, indentation_end) == ' ')
+ if (sci_get_char_at(doc->editor->sci, indentation_end) == ' ')
{
- SSM(doc->editor->scintilla, SCI_SETSEL, indentation_end, indentation_end + 1);
- sci_replace_sel(doc->editor->scintilla, "");
+ SSM(doc->editor->sci, SCI_SETSEL, indentation_end, indentation_end + 1);
+ sci_replace_sel(doc->editor->sci, "");
count--;
if (i == first_line)
first_line_offset = -1;
@@ -2977,7 +2977,7 @@
}
else
{
- sci_insert_text(doc->editor->scintilla, indentation_end, " ");
+ sci_insert_text(doc->editor->sci, indentation_end, " ");
count++;
if (i == first_line)
first_line_offset = 1;
@@ -2990,15 +2990,15 @@
gint start = sel_start + first_line_offset;
if (first_line_offset < 0)
start = MAX(sel_start + first_line_offset,
- SSM(doc->editor->scintilla, SCI_POSITIONFROMLINE, first_line, 0));
+ SSM(doc->editor->sci, SCI_POSITIONFROMLINE, first_line, 0));
- sci_set_selection_start(doc->editor->scintilla, start);
- sci_set_selection_end(doc->editor->scintilla, sel_end + count);
+ sci_set_selection_start(doc->editor->sci, start);
+ sci_set_selection_end(doc->editor->sci, sel_end + count);
}
else
- sci_set_current_position(doc->editor->scintilla, pos + count, FALSE);
+ sci_set_current_position(doc->editor->sci, pos + count, FALSE);
- SSM(doc->editor->scintilla, SCI_ENDUNDOACTION, 0, 0);
+ SSM(doc->editor->sci, SCI_ENDUNDOACTION, 0, 0);
}
@@ -3018,18 +3018,18 @@
if (doc == NULL)
return NULL;
- if (sci_get_lines_selected(doc->editor->scintilla) == 1)
+ if (sci_get_lines_selected(doc->editor->sci) == 1)
{
- gint len = sci_get_selected_text_length(doc->editor->scintilla);
+ gint len = sci_get_selected_text_length(doc->editor->sci);
s = g_malloc(len + 1);
- sci_get_selected_text(doc->editor->scintilla, s);
+ sci_get_selected_text(doc->editor->sci, s);
}
- else if (sci_get_lines_selected(doc->editor->scintilla) == 0 && use_current_word)
+ else if (sci_get_lines_selected(doc->editor->sci) == 0 && use_current_word)
{ /* use the word at current cursor position */
gchar word[GEANY_MAX_WORD_LENGTH];
- editor_find_current_word(doc->editor->scintilla, -1, word, sizeof(word), wordchars);
+ editor_find_current_word(doc->editor->sci, -1, word, sizeof(word), wordchars);
if (word[0] != '\0')
s = g_strdup(word);
}
@@ -3061,11 +3061,11 @@
* so it appears at percent_of_view. */
void editor_display_current_line(GeanyEditor *editor, gfloat percent_of_view)
{
- ScintillaObject *sci = editor->scintilla;
+ ScintillaObject *sci = editor->sci;
gint line = sci_get_current_line(sci);
/* unfold maybe folded results */
- sci_ensure_line_is_visible(editor->scintilla, line);
+ sci_ensure_line_is_visible(editor->sci, line);
/* scroll the line if it's off screen */
if (! editor_line_in_view(sci, line))
@@ -3085,13 +3085,13 @@
g_return_if_fail(editor != NULL);
- last_pos = sci_get_length(editor->scintilla);
+ last_pos = sci_get_length(editor->sci);
if (last_pos > 0)
{
- sci_start_styling(editor->scintilla, 0, INDIC2_MASK);
- sci_set_styling(editor->scintilla, last_pos, 0);
+ sci_start_styling(editor->sci, 0, INDIC2_MASK);
+ sci_set_styling(editor->sci, last_pos, 0);
}
- sci_marker_delete_all(editor->scintilla, 0); /* remove the yellow error line marker */
+ sci_marker_delete_all(editor->sci, 0); /* remove the yellow error line marker */
}
@@ -3112,17 +3112,17 @@
if (editor == NULL)
return;
- start = sci_get_position_from_line(editor->scintilla, line);
- end = sci_get_position_from_line(editor->scintilla, line + 1);
+ start = sci_get_position_from_line(editor->sci, line);
+ end = sci_get_position_from_line(editor->sci, line + 1);
/* skip blank lines */
if ((start + 1) == end ||
- sci_get_line_length(editor->scintilla, line) == editor_get_eol_char_len(editor->document))
+ sci_get_line_length(editor->sci, line) == editor_get_eol_char_len(editor->document))
return;
/* don't set the indicator on whitespace */
len = end - start;
- linebuf = sci_get_line(editor->scintilla, line);
+ linebuf = sci_get_line(editor->sci, line);
while (isspace(linebuf[i])) i++;
while (len > 1 && len > i && isspace(linebuf[len-1]))
@@ -3152,12 +3152,12 @@
if (editor == NULL || start >= end)
return;
- current_mask = sci_get_style_at(editor->scintilla, start);
+ current_mask = sci_get_style_at(editor->sci, start);
current_mask &= INDICS_MASK;
current_mask |= INDIC2_MASK;
- sci_start_styling(editor->scintilla, start, INDIC2_MASK);
- sci_set_styling(editor->scintilla, end - start, current_mask);
+ sci_start_styling(editor->sci, start, INDIC2_MASK);
+ sci_set_styling(editor->sci, end - start, current_mask);
}
@@ -3167,26 +3167,26 @@
{
g_return_if_fail(doc != NULL);
- if (sci_can_copy(doc->editor->scintilla))
+ if (sci_can_copy(doc->editor->sci))
{
- gint start = sci_get_selection_start(doc->editor->scintilla);
+ gint start = sci_get_selection_start(doc->editor->sci);
const gchar *replacement = colour;
- if (sci_get_char_at(doc->editor->scintilla, start) == '0' &&
- sci_get_char_at(doc->editor->scintilla, start + 1) == 'x')
+ if (sci_get_char_at(doc->editor->sci, start) == '0' &&
+ sci_get_char_at(doc->editor->sci, start + 1) == 'x')
{
- sci_set_selection_start(doc->editor->scintilla, start + 2);
- sci_set_selection_end(doc->editor->scintilla, start + 8);
+ sci_set_selection_start(doc->editor->sci, start + 2);
+ sci_set_selection_end(doc->editor->sci, start + 8);
replacement++; /* skip the leading "0x" */
}
- else if (sci_get_char_at(doc->editor->scintilla, start - 1) == '#')
+ else if (sci_get_char_at(doc->editor->sci, start - 1) == '#')
{ /* double clicking something like #00ffff may only select 00ffff because of wordchars */
replacement++; /* so skip the '#' to only replace the colour value */
}
- sci_replace_sel(doc->editor->scintilla, replacement);
+ sci_replace_sel(doc->editor->sci, replacement);
}
else
- sci_add_text(doc->editor->scintilla, colour);
+ sci_add_text(doc->editor->sci, colour);
}
@@ -3195,7 +3195,7 @@
if (doc == NULL)
return "";
- switch (sci_get_eol_mode(doc->editor->scintilla))
+ switch (sci_get_eol_mode(doc->editor->sci))
{
case SC_EOL_CRLF: return _("Win (CRLF)"); break;
case SC_EOL_CR: return _("Mac (CR)"); break;
@@ -3210,7 +3210,7 @@
if (doc == NULL)
return 0;
- switch (sci_get_eol_mode(doc->editor->scintilla))
+ switch (sci_get_eol_mode(doc->editor->sci))
{
case SC_EOL_CRLF: return 2; break;
default: return 1; break;
@@ -3224,7 +3224,7 @@
if (doc == NULL)
return "";
- switch (sci_get_eol_mode(doc->editor->scintilla))
+ switch (sci_get_eol_mode(doc->editor->sci))
{
case SC_EOL_CRLF: return "\r\n"; break;
case SC_EOL_CR: return "\r"; break;
@@ -3239,19 +3239,19 @@
if (doc == NULL || ! editor_prefs.folding) return;
- lines = sci_get_line_count(doc->editor->scintilla);
- first = sci_get_first_visible_line(doc->editor->scintilla);
+ lines = sci_get_line_count(doc->editor->sci);
+ first = sci_get_first_visible_line(doc->editor->sci);
for (i = 0; i < lines; i++)
{
- gint level = sci_get_fold_level(doc->editor->scintilla, i);
+ gint level = sci_get_fold_level(doc->editor->sci, i);
if (level & SC_FOLDLEVELHEADERFLAG)
{
- if (sci_get_fold_expanded(doc->editor->scintilla, i) == want_fold)
- sci_toggle_fold(doc->editor->scintilla, i);
+ if (sci_get_fold_expanded(doc->editor->sci, i) == want_fold)
+ sci_toggle_fold(doc->editor->sci, i);
}
}
- editor_scroll_to_line(doc->editor->scintilla, first, 0.0F);
+ editor_scroll_to_line(doc->editor->sci, first, 0.0F);
}
@@ -3277,31 +3277,31 @@
if (doc == NULL)
return;
- sci_start_undo_action(doc->editor->scintilla);
- tab_len = sci_get_tab_width(doc->editor->scintilla);
+ sci_start_undo_action(doc->editor->sci);
+ tab_len = sci_get_tab_width(doc->editor->sci);
ttf.chrg.cpMin = 0;
- ttf.chrg.cpMax = sci_get_length(doc->editor->scintilla);
+ ttf.chrg.cpMax = sci_get_length(doc->editor->sci);
ttf.lpstrText = (gchar*) "\t";
while (TRUE)
{
- search_pos = sci_find_text(doc->editor->scintilla, SCFIND_MATCHCASE, &ttf);
+ search_pos = sci_find_text(doc->editor->sci, SCFIND_MATCHCASE, &ttf);
if (search_pos == -1)
break;
- pos_in_line = sci_get_col_from_position(doc->editor->scintilla,search_pos);
+ pos_in_line = sci_get_col_from_position(doc->editor->sci,search_pos);
current_tab_true_length = tab_len - (pos_in_line % tab_len);
tab_str = g_strnfill(current_tab_true_length, ' ');
- sci_target_start(doc->editor->scintilla, search_pos);
- sci_target_end(doc->editor->scintilla, search_pos + 1);
- sci_target_replace(doc->editor->scintilla, tab_str, FALSE);
+ sci_target_start(doc->editor->sci, search_pos);
+ sci_target_end(doc->editor->sci, search_pos + 1);
+ sci_target_replace(doc->editor->sci, tab_str, FALSE);
/* next search starts after replacement */
ttf.chrg.cpMin = search_pos + current_tab_true_length - 1;
/* update end of range now text has changed */
ttf.chrg.cpMax += current_tab_true_length - 1;
g_free(tab_str);
}
- sci_end_undo_action(doc->editor->scintilla);
+ sci_end_undo_action(doc->editor->sci);
}
@@ -3317,7 +3317,7 @@
return;
if (tab_len_f < 0.0)
- tab_len_f = sci_get_tab_width(doc->editor->scintilla);
+ tab_len_f = sci_get_tab_width(doc->editor->sci);
if (! dialogs_show_input_numeric(
_("Enter Tab Width"),
@@ -3328,79 +3328,79 @@
}
tab_len = (gint) tab_len_f;
- sci_start_undo_action(doc->editor->scintilla);
+ sci_start_undo_action(doc->editor->sci);
ttf.chrg.cpMin = 0;
- ttf.chrg.cpMax = sci_get_length(doc->editor->scintilla);
+ ttf.chrg.cpMax = sci_get_length(doc->editor->sci);
ttf.lpstrText = g_strnfill(tab_len, ' ');
while (TRUE)
{
- search_pos = sci_find_text(doc->editor->scintilla, SCFIND_MATCHCASE, &ttf);
+ search_pos = sci_find_text(doc->editor->sci, SCFIND_MATCHCASE, &ttf);
if (search_pos == -1)
break;
- sci_target_start(doc->editor->scintilla, search_pos);
- sci_target_end(doc->editor->scintilla, search_pos + tab_len);
- sci_target_replace(doc->editor->scintilla, "\t", FALSE);
+ sci_target_start(doc->editor->sci, search_pos);
+ sci_target_end(doc->editor->sci, search_pos + tab_len);
+ sci_target_replace(doc->editor->sci, "\t", FALSE);
ttf.chrg.cpMin = search_pos;
/* update end of range now text has changed */
ttf.chrg.cpMax -= tab_len - 1;
}
- sci_end_undo_action(doc->editor->scintilla);
+ sci_end_undo_action(doc->editor->sci);
g_free(ttf.lpstrText);
}
void editor_strip_line_trailing_spaces(GeanyDocument *doc, gint line)
{
- gint line_start = sci_get_position_from_line(doc->editor->scintilla, line);
- gint line_end = sci_get_line_end_position(doc->editor->scintilla, line);
+ gint line_start = sci_get_position_from_line(doc->editor->sci, line);
+ gint line_end = sci_get_line_end_position(doc->editor->sci, line);
gint i = line_end - 1;
- gchar ch = sci_get_char_at(doc->editor->scintilla, i);
+ gchar ch = sci_get_char_at(doc->editor->sci, i);
while ((i >= line_start) && ((ch == ' ') || (ch == '\t')))
{
i--;
- ch = sci_get_char_at(doc->editor->scintilla, i);
+ ch = sci_get_char_at(doc->editor->sci, i);
}
if (i < (line_end-1))
{
- sci_target_start(doc->editor->scintilla, i + 1);
- sci_target_end(doc->editor->scintilla, line_end);
- sci_target_replace(doc->editor->scintilla, "", FALSE);
+ sci_target_start(doc->editor->sci, i + 1);
+ sci_target_end(doc->editor->sci, line_end);
+ sci_target_replace(doc->editor->sci, "", FALSE);
}
}
void editor_strip_trailing_spaces(GeanyDocument *doc)
{
- gint max_lines = sci_get_line_count(doc->editor->scintilla);
+ gint max_lines = sci_get_line_count(doc->editor->sci);
gint line;
- sci_start_undo_action(doc->editor->scintilla);
+ sci_start_undo_action(doc->editor->sci);
for (line = 0; line < max_lines; line++)
{
editor_strip_line_trailing_spaces(doc, line);
}
- sci_end_undo_action(doc->editor->scintilla);
+ sci_end_undo_action(doc->editor->sci);
}
void editor_ensure_final_newline(GeanyDocument *doc)
{
- gint max_lines = sci_get_line_count(doc->editor->scintilla);
+ gint max_lines = sci_get_line_count(doc->editor->sci);
gboolean append_newline = (max_lines == 1);
- gint end_document = sci_get_position_from_line(doc->editor->scintilla, max_lines);
+ gint end_document = sci_get_position_from_line(doc->editor->sci, max_lines);
if (max_lines > 1)
{
- append_newline = end_document > sci_get_position_from_line(doc->editor->scintilla, max_lines - 1);
+ append_newline = end_document > sci_get_position_from_line(doc->editor->sci, max_lines - 1);
}
if (append_newline)
{
const gchar *eol = "\n";
- switch (sci_get_eol_mode(doc->editor->scintilla))
+ switch (sci_get_eol_mode(doc->editor->sci))
{
case SC_EOL_CRLF:
eol = "\r\n";
@@ -3409,7 +3409,7 @@
eol = "\r";
break;
}
- sci_insert_text(doc->editor->scintilla, end_document, eol);
+ sci_insert_text(doc->editor->sci, end_document, eol);
}
}
@@ -3428,16 +3428,16 @@
pango_font_description_free(pfd);
for (style = 0; style <= 127; style++)
- sci_set_font(editor->scintilla, style, font_name, size);
+ sci_set_font(editor->sci, style, font_name, size);
/* line number and braces */
- sci_set_font(editor->scintilla, STYLE_LINENUMBER, font_name, size);
- sci_set_font(editor->scintilla, STYLE_BRACELIGHT, font_name, size);
- sci_set_font(editor->scintilla, STYLE_BRACEBAD, font_name, size);
+ sci_set_font(editor->sci, STYLE_LINENUMBER, font_name, size);
+ sci_set_font(editor->sci, STYLE_BRACELIGHT, font_name, size);
+ sci_set_font(editor->sci, STYLE_BRACEBAD, font_name, size);
g_free(font_name);
/* zoom to 100% to prevent confusion */
- sci_zoom_off(editor->scintilla);
+ sci_zoom_off(editor->sci);
}
@@ -3446,7 +3446,7 @@
g_return_if_fail(editor != NULL);
editor->line_wrapping = wrap;
- sci_set_lines_wrapped(editor->scintilla, wrap);
+ sci_set_lines_wrapped(editor->sci, wrap);
}
@@ -3455,9 +3455,9 @@
g_return_if_fail(editor != NULL);
editor->use_tabs = use_tabs;
- sci_set_use_tabs(editor->scintilla, use_tabs);
+ sci_set_use_tabs(editor->sci, use_tabs);
/* remove indent spaces on backspace, if using spaces to indent */
- SSM(editor->scintilla, SCI_SETBACKSPACEUNINDENTS, ! use_tabs, 0);
+ SSM(editor->sci, SCI_SETBACKSPACEUNINDENTS, ! use_tabs, 0);
}
@@ -3473,18 +3473,18 @@
if (mark)
{
- gint line = sci_get_line_from_position(editor->scintilla, pos);
+ gint line = sci_get_line_from_position(editor->sci, pos);
/* mark the tag with the yellow arrow */
- sci_marker_delete_all(editor->scintilla, 0);
- sci_set_marker_at_line(editor->scintilla, line, TRUE, 0);
+ sci_marker_delete_all(editor->sci, 0);
+ sci_set_marker_at_line(editor->sci, line, TRUE, 0);
}
- sci_goto_pos(editor->scintilla, pos, TRUE);
+ sci_goto_pos(editor->sci, pos, TRUE);
editor->scroll_percent = 0.25F;
/* finally switch to the page */
- page_num = gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook), GTK_WIDGET(editor->scintilla));
+ page_num = gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook), GTK_WIDGET(editor->sci));
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), page_num);
return TRUE;
@@ -3499,7 +3499,7 @@
if (event->state & GDK_MOD1_MASK)
{
GeanyDocument *doc = user_data;
- sci_cmd(doc->editor->scintilla, (event->direction == GDK_SCROLL_DOWN) ? SCI_PAGEDOWN : SCI_PAGEUP);
+ sci_cmd(doc->editor->sci, (event->direction == GDK_SCROLL_DOWN) ? SCI_PAGEDOWN : SCI_PAGEUP);
return TRUE;
}
@@ -3525,7 +3525,7 @@
if (DOCUMENT(doc)->colourise_needed)
{
- editor_colourise(doc->editor->scintilla);
+ editor_colourise(doc->editor->sci);
DOCUMENT(doc)->colourise_needed = FALSE;
}
return FALSE; /* propagate event */
@@ -3620,7 +3620,7 @@
editor->scroll_percent = -1.0F;
editor->line_breaking = FALSE;
- editor->scintilla = create_new_sci(doc);
+ editor->sci = create_new_sci(doc);
editor_set_font(editor, interface_prefs.editor_font);
return editor;
}
Modified: branches/editor-struct/src/editor.h
===================================================================
--- branches/editor-struct/src/editor.h 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/src/editor.h 2008-07-14 11:13:54 UTC (rev 2776)
@@ -102,13 +102,13 @@
/** Editor-owned fields for each document. */
typedef struct GeanyEditor
{
- GeanyDocument *document; /**< The document associated with the editor. */
- ScintillaObject *scintilla; /**< The Scintilla editor @c GtkWidget. */
+ GeanyDocument *document; /**< The document associated with the editor. */
+ ScintillaObject *sci; /**< The Scintilla editor @c GtkWidget. */
gboolean line_wrapping; /**< @c TRUE if line wrapping is enabled. */
gboolean auto_indent; /**< @c TRUE if auto-indentation is enabled. */
/** Percentage to scroll view by on paint, if positive. */
gfloat scroll_percent;
- gboolean use_tabs; /**< @c TRUE if tabs are used for indentation. */
+ gboolean use_tabs; /**< @c TRUE if tabs are used for indentation. */
gboolean line_breaking; /**< Whether to split long lines as you type. */
}
GeanyEditor;
Modified: branches/editor-struct/src/filetypes.c
===================================================================
--- branches/editor-struct/src/filetypes.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/src/filetypes.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -667,7 +667,7 @@
if (doc == NULL)
return filetypes[GEANY_FILETYPES_NONE];
- line = sci_get_line(doc->editor->scintilla, 0);
+ line = sci_get_line(doc->editor->sci, 0);
ft = filetypes_detect_from_file_internal(doc->file_name, line);
g_free(line);
return ft;
Modified: branches/editor-struct/src/keybindings.c
===================================================================
--- branches/editor-struct/src/keybindings.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/src/keybindings.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -816,9 +816,9 @@
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* keybinding only valid when scintilla widget has focus */
- if (doc != NULL && focusw == GTK_WIDGET(doc->editor->scintilla))
+ if (doc != NULL && focusw == GTK_WIDGET(doc->editor->sci))
{
- ScintillaObject *sci = doc->editor->scintilla;
+ ScintillaObject *sci = doc->editor->sci;
gint pos = sci_get_current_position(sci);
if (editor_prefs.complete_snippets)
@@ -1174,9 +1174,9 @@
if (doc == NULL)
return FALSE;
- pos = sci_get_current_position(doc->editor->scintilla);
+ pos = sci_get_current_position(doc->editor->sci);
- editor_find_current_word(doc->editor->scintilla, pos,
+ editor_find_current_word(doc->editor->sci, pos,
editor_info.current_word, GEANY_MAX_WORD_LENGTH, NULL);
if (*editor_info.current_word == 0)
@@ -1209,7 +1209,7 @@
{
GeanyDocument *doc = document_get_current();
if (doc != NULL)
- gtk_widget_grab_focus(GTK_WIDGET(doc->editor->scintilla));
+ gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
break;
}
case GEANY_KEYS_FOCUS_SCRIBBLE:
@@ -1284,7 +1284,7 @@
if (doc == NULL)
return;
- sci = GTK_WIDGET(doc->editor->scintilla);
+ sci = GTK_WIDGET(doc->editor->sci);
switch (key_id)
{
@@ -1329,14 +1329,14 @@
if (doc == NULL)
return;
- pos = sci_get_current_position(doc->editor->scintilla);
- if (! utils_isbrace(sci_get_char_at(doc->editor->scintilla, pos), TRUE))
+ pos = sci_get_current_position(doc->editor->sci);
+ if (! utils_isbrace(sci_get_char_at(doc->editor->sci, pos), TRUE))
pos--; /* set pos to the brace */
- new_pos = sci_find_bracematch(doc->editor->scintilla, pos);
+ new_pos = sci_find_bracematch(doc->editor->sci, pos);
if (new_pos != -1)
{ /* set the cursor at the brace */
- sci_set_current_position(doc->editor->scintilla, new_pos, FALSE);
+ sci_set_current_position(doc->editor->sci, new_pos, FALSE);
editor_display_current_line(doc->editor, 0.5F);
}
}
@@ -1361,10 +1361,10 @@
on_paste1_activate(NULL, NULL);
break;
case GEANY_KEYS_CLIPBOARD_COPYLINE:
- sci_cmd(doc->editor->scintilla, SCI_LINECOPY);
+ sci_cmd(doc->editor->sci, SCI_LINECOPY);
break;
case GEANY_KEYS_CLIPBOARD_CUTLINE:
- sci_cmd(doc->editor->scintilla, SCI_LINECUT);
+ sci_cmd(doc->editor->sci, SCI_LINECUT);
break;
}
}
@@ -1379,7 +1379,7 @@
if (doc == NULL)
return;
- cur_line = sci_get_current_line(doc->editor->scintilla);
+ cur_line = sci_get_current_line(doc->editor->sci);
switch (key_id)
{
@@ -1397,29 +1397,29 @@
return;
case GEANY_KEYS_GOTO_TOGGLEMARKER:
{
- gboolean set = sci_is_marker_set_at_line(doc->editor->scintilla, cur_line, 1);
+ gboolean set = sci_is_marker_set_at_line(doc->editor->sci, cur_line, 1);
- sci_set_marker_at_line(doc->editor->scintilla, cur_line, ! set, 1);
+ sci_set_marker_at_line(doc->editor->sci, cur_line, ! set, 1);
return;
}
case GEANY_KEYS_GOTO_NEXTMARKER:
{
- gint mline = sci_marker_next(doc->editor->scintilla, cur_line + 1, 1 << 1, TRUE);
+ gint mline = sci_marker_next(doc->editor->sci, cur_line + 1, 1 << 1, TRUE);
if (mline != -1)
{
- sci_set_current_line(doc->editor->scintilla, mline);
+ sci_set_current_line(doc->editor->sci, mline);
editor_display_current_line(doc->editor, 0.5F);
}
return;
}
case GEANY_KEYS_GOTO_PREVIOUSMARKER:
{
- gint mline = sci_marker_previous(doc->editor->scintilla, cur_line - 1, 1 << 1, TRUE);
+ gint mline = sci_marker_previous(doc->editor->sci, cur_line - 1, 1 << 1, TRUE);
if (mline != -1)
{
- sci_set_current_line(doc->editor->scintilla, mline);
+ sci_set_current_line(doc->editor->sci, mline);
editor_display_current_line(doc->editor, 0.5F);
}
return;
@@ -1434,7 +1434,7 @@
return;
}
/* only check editor-sensitive keybindings when editor has focus */
- if (gtk_window_get_focus(GTK_WINDOW(main_widgets.window)) != GTK_WIDGET(doc->editor->scintilla))
+ if (gtk_window_get_focus(GTK_WINDOW(main_widgets.window)) != GTK_WIDGET(doc->editor->sci))
{
ignore_keybinding = TRUE;
return;
@@ -1442,10 +1442,10 @@
switch (key_id)
{
case GEANY_KEYS_GOTO_LINESTART:
- sci_cmd(doc->editor->scintilla, editor_prefs.smart_home_key ? SCI_VCHOME : SCI_HOME);
+ sci_cmd(doc->editor->sci, editor_prefs.smart_home_key ? SCI_VCHOME : SCI_HOME);
break;
case GEANY_KEYS_GOTO_LINEEND:
- sci_cmd(doc->editor->scintilla, SCI_LINEEND);
+ sci_cmd(doc->editor->sci, SCI_LINEEND);
break;
}
}
@@ -1479,7 +1479,7 @@
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* edit keybindings only valid when scintilla widget has focus */
- if (doc == NULL || focusw != GTK_WIDGET(doc->editor->scintilla))
+ if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci))
return;
switch (key_id)
@@ -1491,31 +1491,31 @@
on_redo1_activate(NULL, NULL);
break;
case GEANY_KEYS_EDITOR_SCROLLTOLINE:
- editor_scroll_to_line(doc->editor->scintilla, -1, 0.5F);
+ editor_scroll_to_line(doc->editor->sci, -1, 0.5F);
break;
case GEANY_KEYS_EDITOR_SCROLLLINEUP:
- sci_cmd(doc->editor->scintilla, SCI_LINESCROLLUP);
+ sci_cmd(doc->editor->sci, SCI_LINESCROLLUP);
break;
case GEANY_KEYS_EDITOR_SCROLLLINEDOWN:
- sci_cmd(doc->editor->scintilla, SCI_LINESCROLLDOWN);
+ sci_cmd(doc->editor->sci, SCI_LINESCROLLDOWN);
break;
case GEANY_KEYS_EDITOR_DUPLICATELINE:
- duplicate_lines(doc->editor->scintilla);
+ duplicate_lines(doc->editor->sci);
break;
case GEANY_KEYS_EDITOR_DELETELINE:
- delete_lines(doc->editor->scintilla);
+ delete_lines(doc->editor->sci);
break;
case GEANY_KEYS_EDITOR_TRANSPOSELINE:
- sci_cmd(doc->editor->scintilla, SCI_LINETRANSPOSE);
+ sci_cmd(doc->editor->sci, SCI_LINETRANSPOSE);
break;
case GEANY_KEYS_EDITOR_AUTOCOMPLETE:
- editor_start_auto_complete(doc, sci_get_current_position(doc->editor->scintilla), TRUE);
+ editor_start_auto_complete(doc, sci_get_current_position(doc->editor->sci), TRUE);
break;
case GEANY_KEYS_EDITOR_CALLTIP:
editor_show_calltip(doc, -1);
break;
case GEANY_KEYS_EDITOR_MACROLIST:
- editor_show_macro_list(doc->editor->scintilla);
+ editor_show_macro_list(doc->editor->sci);
break;
case GEANY_KEYS_EDITOR_CONTEXTACTION:
if (check_current_word())
@@ -1530,10 +1530,10 @@
switch (kb->key)
{
case GDK_space:
- sci_add_text(doc->editor->scintilla, " ");
+ sci_add_text(doc->editor->sci, " ");
break;
case GDK_Tab:
- sci_cmd(doc->editor->scintilla, SCI_TAB);
+ sci_cmd(doc->editor->sci, SCI_TAB);
break;
default:
break;
@@ -1551,7 +1551,7 @@
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* keybindings only valid when scintilla widget has focus */
- if (doc == NULL || focusw != GTK_WIDGET(doc->editor->scintilla))
+ if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci))
return;
switch (key_id)
@@ -1616,7 +1616,7 @@
}
/* keybindings only valid when scintilla widget has focus */
- if (doc == NULL || focusw != GTK_WIDGET(doc->editor->scintilla))
+ if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci))
return;
switch (key_id)
@@ -1625,13 +1625,13 @@
on_menu_select_all1_activate(NULL, NULL);
break;
case GEANY_KEYS_SELECT_WORD:
- editor_select_word(doc->editor->scintilla);
+ editor_select_word(doc->editor->sci);
break;
case GEANY_KEYS_SELECT_LINE:
- editor_select_lines(doc->editor->scintilla, FALSE);
+ editor_select_lines(doc->editor->sci, FALSE);
break;
case GEANY_KEYS_SELECT_PARAGRAPH:
- editor_select_paragraph(doc->editor->scintilla);
+ editor_select_paragraph(doc->editor->sci);
break;
}
}
@@ -1669,8 +1669,8 @@
case GEANY_KEYS_DOCUMENT_TOGGLEFOLD:
if (editor_prefs.folding)
{
- gint line = sci_get_current_line(doc->editor->scintilla);
- sci_toggle_fold(doc->editor->scintilla, line);
+ gint line = sci_get_current_line(doc->editor->sci);
+ sci_toggle_fold(doc->editor->sci, line);
break;
}
}
@@ -1684,7 +1684,7 @@
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* keybindings only valid when scintilla widget has focus */
- if (doc == NULL || focusw != GTK_WIDGET(doc->editor->scintilla)) return;
+ if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci)) return;
switch (key_id)
{
Modified: branches/editor-struct/src/keyfile.c
===================================================================
--- branches/editor-struct/src/keyfile.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/src/keyfile.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -144,7 +144,7 @@
ft = filetypes[GEANY_FILETYPES_NONE];
fname = g_strdup_printf("%d;%s;%d;%d;%d;%d;%d;%s;",
- sci_get_current_position(doc->editor->scintilla),
+ sci_get_current_position(doc->editor->sci),
ft->name,
doc->readonly,
encodings_get_idx_from_charset(doc->encoding),
Modified: branches/editor-struct/src/main.c
===================================================================
--- branches/editor-struct/src/main.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/src/main.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -910,7 +910,7 @@
ui_save_buttons_toggle(FALSE);
doc = document_get_current();
- gtk_widget_grab_focus(GTK_WIDGET(doc->editor->scintilla));
+ gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
treeviews_select_openfiles_item(doc);
build_menu_update(doc);
treeviews_update_tag_list(doc, FALSE);
Modified: branches/editor-struct/src/navqueue.c
===================================================================
--- branches/editor-struct/src/navqueue.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/src/navqueue.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ -151,12 +151,12 @@
g_return_val_if_fail(new_doc != NULL, FALSE);
g_return_val_if_fail(line >= 1, FALSE);
- pos = sci_get_position_from_line(new_doc->editor->scintilla, line - 1);
+ pos = sci_get_position_from_line(new_doc->editor->sci, line - 1);
/* first add old file position */
if (old_doc != NULL && old_doc->file_name)
{
- gint cur_pos = sci_get_current_position(old_doc->editor->scintilla);
+ gint cur_pos = sci_get_current_position(old_doc->editor->sci);
add_new_position(old_doc->file_name, cur_pos);
}
Modified: branches/editor-struct/src/notebook.c
===================================================================
--- branches/editor-struct/src/notebook.c 2008-07-13 11:51:00 UTC (rev 2775)
+++ branches/editor-struct/src/notebook.c 2008-07-14 11:13:54 UTC (rev 2776)
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list