コード例 #1
0
ファイル: formatutils.c プロジェクト: BYC/geany-plugins
void glatex_insert_latex_fontsize(G_GNUC_UNUSED GtkMenuItem * menuitem,
						 G_GNUC_UNUSED gpointer gdata)
{
	gint size = GPOINTER_TO_INT(gdata);
	GeanyDocument *doc = NULL;
	doc = document_get_current();

	if (doc != NULL)
	{
		if (sci_has_selection(doc->editor->sci))
		{
			gchar *selection;
			gchar *replacement = NULL;

			selection = sci_get_selection_contents(doc->editor->sci);

			replacement = g_strconcat("{",glatex_fontsize_pattern[size],
				" ", selection, "}", NULL);

			sci_replace_sel(doc->editor->sci, replacement);
			g_free(selection);
			g_free(replacement);
		}
		else
		{
			sci_start_undo_action(doc->editor->sci);
			glatex_insert_string(glatex_fontsize_pattern[size], TRUE);
			glatex_insert_string(" ", TRUE);
			sci_end_undo_action(doc->editor->sci);
		}
	}
}
コード例 #2
0
ファイル: zen-editor.c プロジェクト: b4n/geany-zencoding
static PyObject *
ZenEditor_replace_content(ZenEditor *self, PyObject *args)
{
	PyObject *result;
	gint sel_start = -1, sel_end = -1, ph_pos;
	gchar *text, *ph, *tmp, *tmp2;
	ScintillaObject *sci;

	print_called();
	py_return_none_if_null(sci = ZenEditor_get_scintilla(self));

	if (PyArg_ParseTuple(args, "s|ii", &text, &sel_start, &sel_end))
	{
		tmp = ZenEditor_replace_caret_placeholder(self->caret_placeholder, text, &ph_pos);
		tmp2 = ZenEditor_replace_range(tmp);
		g_free(tmp);

		if (sel_start == -1 && sel_end == -1)
		{
			/* replace whole editor content */
			sci_set_text(sci, tmp2);
		}
		else if (sel_start != -1 && sel_end == -1)
		{
			/* insert text at sel_start */
			sci_insert_text(sci, sel_start, tmp2);
		}
		else if (sel_start != -1 && sel_end != -1)
		{
			/* replace from sel_start to sel_end */
			sci_set_selection_start(sci, sel_start);
			sci_set_selection_end(sci, sel_end);
			sci_replace_sel(sci, tmp2);
		}
		else
		{
			dbgf("Invalid arguments were supplied.");
			g_free(tmp2);
			Py_RETURN_NONE;
		}

		g_free(tmp2);

		/* Move cursor to first placeholder position, if found */
		if (ph_pos > -1)
			sci_set_current_position(sci, sel_start + ph_pos, TRUE);

	}
	else
	{
		if (PyErr_Occurred())
		{
			PyErr_Print();
			PyErr_Clear();
		}
	}

	Py_RETURN_NONE;
}
コード例 #3
0
static PyObject *
Scintilla_replace_sel(Scintilla *self, PyObject *args, PyObject *kwargs)
{
	gchar *text;
	static gchar *kwlist[] = { "text", NULL };
	SCI_RET_IF_FAIL(self);
	if (PyArg_ParseTupleAndKeywords(args, kwargs, "s", kwlist, &text))
		sci_replace_sel(self->sci, text);
	Py_RETURN_NONE;
}
コード例 #4
0
ファイル: callbacks.c プロジェクト: ndunsworth/geany
void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data)
{
	GeanyDocument *doc = document_get_current();
	ScintillaObject *sci;
	gchar *text;
	gboolean keep_sel = TRUE;

	g_return_if_fail(doc != NULL);

	sci = doc->editor->sci;
	if (! sci_has_selection(sci))
	{
		keybindings_send_command(GEANY_KEY_GROUP_SELECT, GEANY_KEYS_SELECT_WORD);
		keep_sel = FALSE;
	}

	/* either we already had a selection or we created one for current word */
	if (sci_has_selection(sci))
	{
		gchar *result = NULL;
		gint cmd = SCI_LOWERCASE;
		gboolean rectsel = (gboolean) scintilla_send_message(sci, SCI_SELECTIONISRECTANGLE, 0, 0);

		text = sci_get_selection_contents(sci);

		if (utils_str_has_upper(text))
		{
			if (rectsel)
				cmd = SCI_LOWERCASE;
			else
				result = g_utf8_strdown(text, -1);
		}
		else
		{
			if (rectsel)
				cmd = SCI_UPPERCASE;
			else
				result = g_utf8_strup(text, -1);
		}

		if (result != NULL)
		{
			sci_replace_sel(sci, result);
			g_free(result);
			if (keep_sel)
				sci_set_selection_start(sci, sci_get_current_position(sci) - strlen(text));
		}
		else
			sci_send_command(sci, cmd);

		g_free(text);

	}
}
コード例 #5
0
ファイル: plugin.c プロジェクト: R1dO/geany-plugins
static gboolean editor_notify_cb(GObject *object, GeanyEditor *editor,
								SCNotification *nt, gpointer data)
{
	gint lexer, pos, style, min, size;
	gchar sel[512];

	if (nt->nmhdr.code == SCN_CHARADDED && nt->ch == '>')
	{
		lexer = sci_get_lexer(editor->sci);
		if (lexer == SCLEX_XML || lexer == SCLEX_HTML)
		{
			pos = sci_get_current_position(editor->sci);
			style = sci_get_style_at(editor->sci, pos);

			if ((style <= SCE_H_XCCOMMENT || highlighting_is_string_style(lexer, style)) &&
				!highlighting_is_comment_style(lexer, style))
			{
				CompletionInfo c;
				InputInfo i;

				/* Grab the last 512 characters or so */
				min = pos - sizeof(sel);
				if (min < 0) min = 0;
				size = pos - min;

				sci_get_text_range(editor->sci, min, pos, sel);

				if (get_completion(editor, sel, size, &c, &i))
				{
					/* Remove typed opening tag */
					sci_set_selection_start(editor->sci, min + i.tag_start);
					sci_set_selection_end(editor->sci, pos);
					sci_replace_sel(editor->sci, "");
					pos -= (size - i.tag_start); /* pos has changed while deleting */

					/* Insert the completion */
					editor_insert_snippet(editor, pos, c.completion);
					sci_scroll_caret(editor->sci);

					g_free((gchar *)c.completion);
					return TRUE;
				}
			}
		}
	}
	return FALSE;
}
コード例 #6
0
ファイル: formatutils.c プロジェクト: BYC/geany-plugins
void glatex_insert_latex_format(G_GNUC_UNUSED GtkMenuItem * menuitem,
						 G_GNUC_UNUSED gpointer gdata)
{
	gint format = GPOINTER_TO_INT(gdata);
	GeanyDocument *doc = NULL;
	doc = document_get_current();

	if (doc != NULL)
	{
		if (sci_has_selection(doc->editor->sci))
		{
			gchar *selection;
			gchar *replacement = NULL;

			selection = sci_get_selection_contents(doc->editor->sci);

			if (format == LATEX_SMALLCAPS &&
				glatex_lowercase_on_smallcaps == TRUE)
			{
				gchar *new_selection = NULL;
				new_selection = g_utf8_strdown(selection, -1);
				g_free(selection);
				selection = g_strdup(new_selection);
				g_free(new_selection);
			}
			replacement = g_strconcat(glatex_format_pattern[format],"{",
				selection, "}", NULL);

			sci_replace_sel(doc->editor->sci, replacement);
			g_free(selection);
			g_free(replacement);
		}
		else
		{
			sci_start_undo_action(doc->editor->sci);
			glatex_insert_string(glatex_format_pattern[format], TRUE);
			glatex_insert_string("{", TRUE);
			glatex_insert_string("}", FALSE);
			sci_end_undo_action(doc->editor->sci);
		}
	}
}
コード例 #7
0
ファイル: latexstructure.c プロジェクト: BYC/geany-plugins
void glatex_structure_lvlup(void)
{
	gint i;
	GeanyDocument *doc = NULL;
	gchar *tmp = NULL;
	GString *haystack = NULL;

	doc = document_get_current();

	if (doc == NULL)
		return;

	if (! sci_has_selection(doc->editor->sci))
		return;

	sci_start_undo_action(doc->editor->sci);
	tmp = sci_get_selection_contents(doc->editor->sci);
	haystack = g_string_new(tmp);

	g_free(tmp);
	tmp = NULL;

	for (i = 0; i < GLATEX_STRUCTURE_N_LEVEL; i++)
	{
		if (utils_string_replace_all
			(haystack,
			glatex_structure_values[i],
			glatex_structure_values[glatex_structure_rotate(FALSE, i)]
			) > 0)
		{
			tmp = g_string_free(haystack, FALSE);
			haystack = NULL;
			sci_replace_sel(doc->editor->sci, tmp);
			g_free(tmp);
			sci_end_undo_action(doc->editor->sci);
			break;
		}
	}

	if (haystack != NULL)
		g_string_free(haystack, TRUE);
}
コード例 #8
0
ファイル: gui.c プロジェクト: AtalAkbari/geany-plugins
static void menu_suggestion_item_activate_cb(GtkMenuItem *menuitem, gpointer gdata)
{
    const gchar *sugg;
    gint startword, endword;
    ScintillaObject *sci = clickinfo.doc->editor->sci;

    g_return_if_fail(clickinfo.doc != NULL && clickinfo.pos != -1);

    startword = scintilla_send_message(sci, SCI_WORDSTARTPOSITION, clickinfo.pos, 0);
    endword = scintilla_send_message(sci, SCI_WORDENDPOSITION, clickinfo.pos, 0);

    if (startword != endword)
    {
        gchar *word;

        sci_set_selection_start(sci, startword);
        sci_set_selection_end(sci, endword);

        /* retrieve the old text */
        word = g_malloc(sci_get_selected_text_length(sci) + 1);
        sci_get_selected_text(sci, word);

        /* retrieve the new text */
        sugg = gtk_label_get_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(menuitem))));

        /* replace the misspelled word with the chosen suggestion */
        sci_replace_sel(sci, sugg);

        /* store the replacement for future checks */
        sc_speller_store_replacement(word, sugg);

        /* remove indicator */
        sci_indicator_clear(sci, startword, endword - startword);

        g_free(word);
    }
}
コード例 #9
0
ファイル: insertnum.c プロジェクト: DaveMDS/geany-plugins
static void insert_numbers(gboolean *cancel)
{
	/* editor */
	ScintillaObject *sci = document_get_current()->editor->sci;
	gint xinsert = sci_point_x_from_position(sci, start_pos);
	gint xend = sci_point_x_from_position(sci, end_pos);
	gint *line_pos = g_new(gint, end_line - start_line + 1);
	gint line, i;
	/* generator */
	gint64 start = start_value;
	gint64 value;
	unsigned count = 0;
	size_t prefix_len = 0;
	int plus = 0, minus;
	size_t length, lend;
	char pad, aax;
	gchar *buffer;

	if (xend < xinsert)
		xinsert = xend;

	ui_progress_bar_start(_("Counting..."));
	/* lines shorter than the current selection are skipped */
	for (line = start_line, i = 0; line <= end_line; line++, i++)
	{
		if (sci_point_x_from_position(sci,
			scintilla_send_message(sci, SCI_GETLINEENDPOSITION, line, 0)) >= xinsert)
		{
			line_pos[i] = sci_get_pos_at_line_sel_start(sci, line) -
				sci_get_position_from_line(sci, line);
			count++;
		}
		else
			line_pos[i] = -1;

		if (cancel && i % 2500 == 0)
		{
			update_display();
			if (*cancel)
			{
				ui_progress_bar_stop();
				g_free(line_pos);
				return;
			}
		}
	}

	switch (base_value * base_prefix)
	{
		case 8 : prefix_len = 1; break;
		case 16 : prefix_len = 2; break;
		case 10 : plus++;
	}

	value = start + (count - 1) * step_value;
	minus = start < 0 || value < 0;
	lend = plus || (pad_zeros ? minus : value < 0);
	while (value /= base_value) lend++;
	value = start;
	length = plus || (pad_zeros ? minus : value < 0);
	while (value /= base_value) length++;
	length = prefix_len + (length > lend ? length : lend) + 1;

	buffer = g_new(gchar, length + 1);
	buffer[length] = '\0';
	pad = pad_zeros ? '0' : ' ';
	aax = (lower_case ? 'a' : 'A') - 10;

	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(geany->main_widgets->progressbar),
		_("Preparing..."));
	update_display();
	sci_start_undo_action(sci);
	sci_replace_sel(sci, "");

	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(geany->main_widgets->progressbar),
		_("Inserting..."));
	for (line = start_line, i = 0; line <= end_line; line++, i++)
	{
		gchar *beg, *end;
		gint insert_pos;

		if (line_pos[i] < 0)
			continue;

		beg = buffer;
		end = buffer + length;
		value = ABS(start);

		do
		{
			unsigned digit = value % base_value;
			*--end = digit + (digit < 10 ? '0' : aax);
		} while (value /= base_value);

		if (pad_zeros)
		{
			if (start < 0) *beg++ = '-';
			else if (plus) *beg++ = '+';
			else if (minus) *beg++ = ' ';
			memcpy(beg, "0x", prefix_len);
			beg += prefix_len;
		}
		else
		{
			if (start < 0) *--end = '-';
			else if (plus) *--end = '+';
			end -= prefix_len;
			memcpy(end, "0x", prefix_len);
		}

		memset(beg, pad, end - beg);
		insert_pos = sci_get_position_from_line(sci, line) + line_pos[i];
		sci_insert_text(sci, insert_pos, buffer);
		start += step_value;

		if (cancel && i % 1000 == 0)
		{
			update_display();
			if (*cancel)
			{
				scintilla_send_message(sci, SCI_GOTOPOS, insert_pos + length, 0);
				break;
			}
		}
	}

	sci_end_undo_action(sci);
	g_free(buffer);
	g_free(line_pos);
	ui_progress_bar_stop();
}
コード例 #10
0
/* if type == -1 then we will try to autodetect the type */
void glatex_insert_environment(const gchar *environment, gint type)
{
	GeanyDocument *doc = NULL;

	doc = document_get_current();

	/* Only do anything if it is realy needed to */
	if (doc != NULL && environment != NULL)
	{
		if (sci_has_selection(doc->editor->sci))
		{
			gchar *selection  = NULL;
			gchar *replacement = NULL;
			selection = sci_get_selection_contents(doc->editor->sci);

			sci_start_undo_action(doc->editor->sci);
			if (utils_str_equal(environment, "block") == TRUE)
			{
				replacement = g_strconcat("\\begin{", environment, "}{}\n",
							  selection, "\n\\end{", environment, "}\n", NULL);
			}
			else
			{
				replacement = g_strconcat("\\begin{", environment, "}\n",
							  selection, "\n\\end{", environment, "}\n", NULL);
			}
			sci_replace_sel(doc->editor->sci, replacement);
			sci_end_undo_action(doc->editor->sci);
			g_free(selection);
			g_free(replacement);

		}
		else
		{
			gint indent, pos;
			GString *tmpstring = NULL;
			gchar *tmp = NULL;
			static const GeanyIndentPrefs *indention_prefs = NULL;

			if (type == -1)
			{
				gint i;

				/* First, we check whether we have a known list over here
				 * an reset type to fit new value*/
				for (i = 0; i < GLATEX_LIST_END; i++)
				{
					if (utils_str_equal(glatex_list_environments[i], environment) == TRUE)
					{
						type = GLATEX_ENVIRONMENT_TYPE_LIST;
						break;
					}
				}
			}
			pos = sci_get_current_position(doc->editor->sci);

			sci_start_undo_action(doc->editor->sci);

			tmpstring = g_string_new("\\begin{");
			g_string_append(tmpstring, environment);

			if (utils_str_equal(environment, "block") == TRUE)
			{
				g_string_append(tmpstring, "}{}");
			}
			else
			{
				g_string_append(tmpstring, "}");
			}
			g_string_append(tmpstring, "\n");


			if (type == GLATEX_ENVIRONMENT_TYPE_LIST)
			{
				g_string_append(tmpstring, "\t\\item ");
			}

			tmp = g_string_free(tmpstring, FALSE);
			glatex_insert_string(tmp, TRUE);
			g_free(tmp);

			indent = sci_get_line_indentation(doc->editor->sci,
				sci_get_line_from_position(doc->editor->sci, pos));

			tmp = g_strdup_printf("\n\\end{%s}", environment);
			glatex_insert_string(tmp, FALSE);
			g_free(tmp);

			indention_prefs = editor_get_indent_prefs(doc->editor);
			if (type == GLATEX_ENVIRONMENT_TYPE_LIST)
			{
				sci_set_line_indentation(doc->editor->sci,
					sci_get_current_line(doc->editor->sci),
					indent + indention_prefs->width);
			}
			sci_set_line_indentation(doc->editor->sci,
				sci_get_current_line(doc->editor->sci) + 1, indent);
			sci_end_undo_action(doc->editor->sci);
		}
	}
}
コード例 #11
0
ファイル: shiftcolumn.c プロジェクト: JJ77/geany-plugins
static void shift_left_cb(G_GNUC_UNUSED GtkMenuItem *menuitem,
                          G_GNUC_UNUSED gpointer gdata){
   gchar *txt;
   gchar *txt_i;
   gchar char_before;
   gint txt_len;

   gint startpos;
   gint endpos;

   gint startline;
   gint endline;
   gint line_iter;
   gint linepos;
   gint linelen;

   gint startcol;
   gint endcol;

   gint i;

   gint n_spaces;
   gchar *spaces;

   ScintillaObject *sci;

   /* get a pointer to the scintilla object */
   sci = document_get_current()->editor->sci;

   if (sci_has_selection(sci)){

      startpos = sci_get_selection_start(sci);
      endpos = sci_get_selection_end(sci);

      /* sanity check -- we dont care which way the block was selected */
      if(startpos > endpos){
         i = endpos;
         endpos = startpos;
         startpos = i;
         }

      startline = sci_get_line_from_position(sci, startpos);
      /* Setting also start point for 1st line */
      linepos = sci_get_position_from_line(sci, startline);
      endline = sci_get_line_from_position(sci, endpos);

      /* normal mode */
      if(startline == endline){

         /* get the text in question */
         txt_len = endpos - startpos;
         txt_i = g_malloc(txt_len + 1);
         txt = g_malloc(txt_len + 2);
         sci_get_selected_text(sci, txt_i);

         char_before = sci_get_char_at(sci, startpos - 1);

         /* set up new text buf */
         (void) g_sprintf(txt, "%s%c", txt_i, char_before);

         /* start undo */
         sci_start_undo_action(sci);

         /* put the new text in */
         sci_set_selection_start(sci, startpos - 1);
         sci_replace_sel(sci, txt);

         /* select the right bit again */
         sci_set_selection_start(sci, startpos - 1);
         sci_set_selection_end(sci, endpos - 1);

         /* end undo */
         sci_end_undo_action(sci);

         g_free(txt);
         g_free(txt_i);
         }

      /* rectangle mode (we hope!) */
      else{
         startcol = sci_get_col_from_position(sci, startpos);
         endcol = sci_get_col_from_position(sci, endpos);

         /* return early for the trivial case */
         if(startcol == 0 || startcol == endcol){
            return;
            }

         /* start undo */
         sci_start_undo_action(sci);

         for(line_iter = startline; line_iter <= endline; line_iter++){
            linepos = sci_get_position_from_line(sci, line_iter);
            linelen = sci_get_line_length(sci, line_iter);

            /* do we need to do something */
            if(linelen >= startcol - 1 ){

               /* if between the two columns */
               /* pad to the end first */
               if(linelen <= endcol){

                  /* bung in some spaces -- sorry, I dont like tabs */
                  n_spaces = endcol - linelen + 1;
                  spaces = g_malloc(sizeof(gchar) * (n_spaces + 1));
                  for(i = 0; i < n_spaces; i++){
                     spaces[i] = ' ';
                     }
                  spaces[i] = '\0';

                  sci_insert_text(sci, linepos + linelen - 1, spaces);
                  g_free(spaces);
                  }

               /* now move the text itself */
               sci_set_selection_mode(sci, 0);
               sci_set_selection_start(sci, linepos + startcol);
               sci_set_selection_end(sci, linepos + endcol);

               txt_len = sci_get_selected_text_length(sci);
               txt_i = g_malloc(txt_len + 1);
               txt = g_malloc(txt_len + 2);

               sci_get_selected_text(sci, txt_i);
               char_before = sci_get_char_at(sci, linepos + startcol - 1);

               /* set up new text buf */
               (void) g_sprintf(txt, "%s%c", txt_i, char_before);

               /* put the new text in */
               sci_set_selection_start(sci, linepos + startcol - 1);
               sci_replace_sel(sci, txt);

               g_free(txt);
               g_free(txt_i);
               }
            }

         /* put the selection box back */
         /* here we rely upon the last result of linepos */
         sci_set_selection_mode(sci, 1);
         sci_set_selection_start(sci, startpos - 1);
         sci_set_selection_end(sci, linepos + endcol - 1);

         /* end undo action */
         sci_end_undo_action(sci);
         }

      }
   }
コード例 #12
0
ファイル: shiftcolumn.c プロジェクト: JJ77/geany-plugins
static void shift_right_cb(G_GNUC_UNUSED GtkMenuItem *menuitem,
                           G_GNUC_UNUSED gpointer gdata){
   gchar *txt;
   gchar *txt_i;
   gchar char_after;
   gint txt_len;

   gint startpos;
   gint endpos;

   gint startline;
   gint endline;
   gint line_iter;
   gint linepos;
   gint linelen;

   gint startcol;
   gint endcol;

   gint i;

   ScintillaObject *sci;

   /* get a pointer to the scintilla object */
   sci = document_get_current()->editor->sci;

   if (sci_has_selection(sci)){

      startpos = sci_get_selection_start(sci);
      endpos = sci_get_selection_end(sci);

      /* sanity check -- we dont care which way the block was selected */
      if(startpos > endpos){
         i = endpos;
         endpos = startpos;
         startpos = i;
         }

      startline = sci_get_line_from_position(sci, startpos);
      linepos = sci_get_position_from_line(sci, startline);
      endline = sci_get_line_from_position(sci, endpos);

      /* normal mode */
      if(startline == endline){

         /* get the text in question */
         txt_len = endpos - startpos;
         txt_i = g_malloc(txt_len + 1);
         txt = g_malloc(txt_len + 2);
         sci_get_selected_text(sci, txt_i);

         char_after = sci_get_char_at(sci, endpos);

         /* set up new text buf */
         (void) g_sprintf(txt, "%c%s", char_after, txt_i);

         /* start undo */
         sci_start_undo_action(sci);

         /* put the new text in */
         sci_set_selection_end(sci, endpos + 1);
         sci_replace_sel(sci, txt);

         /* select the right bit again */
         sci_set_selection_start(sci, startpos + 1);
         sci_set_selection_end(sci, endpos + 1);

         /* end undo */
         sci_end_undo_action(sci);

         g_free(txt);
         g_free(txt_i);
         }

      /* rectangle mode (we hope!) */
      else{
         startcol = sci_get_col_from_position(sci, startpos);
         endcol = sci_get_col_from_position(sci, endpos);

         /* start undo */
         sci_start_undo_action(sci);

         for(line_iter = startline; line_iter <= endline; line_iter++){
            linepos = sci_get_position_from_line(sci, line_iter);
            linelen = sci_get_line_length(sci, line_iter);

            /* do we need to do something */
            if(linelen >= startcol - 1 ){

               /* if between the two columns or at the end */
               /* add in a space */
               if(linelen <= endcol || linelen - 1 == endcol){
                  txt = g_malloc(sizeof(gchar) * 2);
                  sprintf(txt, " ");

                  sci_insert_text(sci, linepos + startcol, txt);
                  g_free(txt);
                  }

               else{
                  /* move the text itself */
                  sci_set_selection_mode(sci, 0);
                  sci_set_selection_start(sci, linepos + startcol);
                  sci_set_selection_end(sci, linepos + endcol);

                  txt_len = sci_get_selected_text_length(sci);
                  txt_i = g_malloc(txt_len + 1);
                  txt = g_malloc(txt_len + 2);

                  sci_get_selected_text(sci, txt_i);
                  char_after = sci_get_char_at(sci, linepos + endcol);

                  /* set up new text buf */
                  (void) g_sprintf(txt, "%c%s", char_after, txt_i);

                  /* put the new text in */
                  sci_set_selection_end(sci, linepos + endcol + 1);
                  sci_replace_sel(sci, txt);

                  g_free(txt);
                  g_free(txt_i);
                  }
               }
            }

         /* put the selection box back */
         /* here we rely upon the last result of linepos */
         sci_set_selection_mode(sci, 1);
         sci_set_selection_start(sci, startpos + 1);
         sci_set_selection_end(sci, linepos + endcol + 1);

         /* end undo action */
         sci_end_undo_action(sci);
         }
      }
   }
コード例 #13
0
ファイル: gms.c プロジェクト: DaveMDS/geany-plugins
/**
 * \brief the function updates the current document
 */
static void update_doc( ScintillaObject *sci, gchar * contents )
{
    if (contents==NULL) return ;
    sci_replace_sel( sci, contents );
}