Ejemplo n.º 1
0
static void convert_eol(gint mode)
{
	GeanyDocument *doc = document_get_current();

	g_return_if_fail(doc != NULL);

	/* sci_convert_eols() adds UNDO_SCINTILLA action in on_editor_notify().
	 * It is added to the undo stack before sci_convert_eols() finishes
	 * so after adding UNDO_EOL, UNDO_EOL will be at the top of the stack
	 * and UNDO_SCINTILLA below it. */
	sci_convert_eols(doc->editor->sci, mode);
	document_undo_add(doc, UNDO_EOL, GINT_TO_POINTER(sci_get_eol_mode(doc->editor->sci)));

	sci_set_eol_mode(doc->editor->sci, mode);

	ui_update_statusbar(doc, -1);
}
Ejemplo n.º 2
0
static void encodings_radio_item_change_cb(GtkCheckMenuItem *menuitem, gpointer user_data)
{
	GeanyDocument *doc = document_get_current();
	guint i = GPOINTER_TO_INT(user_data);

	if (ignore_callback || doc == NULL || encodings[i].charset == NULL ||
		! gtk_check_menu_item_get_active(menuitem) ||
		utils_str_equal(encodings[i].charset, doc->encoding))
		return;

	if (doc->readonly)
	{
		utils_beep();
		return;
	}
	document_undo_add(doc, UNDO_ENCODING, g_strdup(doc->encoding));

	document_set_encoding(doc, encodings[i].charset);
}