Ejemplo n.º 1
0
static gboolean tooltip_launch(gpointer gdata)
{
	GeanyDocument *doc = document_get_current();

	if (doc && utils_source_document(doc) && doc->editor == gdata &&
		(debug_state() & DS_SENDABLE))
	{
		ScintillaObject *sci = doc->editor->sci;
		gchar *expr = sci_get_selection_mode(sci) == SC_SEL_STREAM &&
			peek_pos >= sci_get_selection_start(sci) &&
			peek_pos < sci_get_selection_end(sci) ?
			editor_get_default_selection(doc->editor, FALSE, NULL) :
			editor_get_word_at_pos(doc->editor, peek_pos, NULL);

		if ((expr = utils_verify_selection(expr)) != NULL)
		{
			g_free(input);
			input = debug_send_evaluate('3', scid_gen, expr);
			g_free(expr);
		}
		else
			tooltip_set(NULL);
	}
	else
		tooltip_set(NULL);

	query_id = 0;
	return FALSE;
}
Ejemplo n.º 2
0
static PyObject *
Scintilla_get_selection_mode(Scintilla *self)
{
	gint mode;
	SCI_RET_IF_FAIL(self);
	mode = sci_get_selection_mode(self->sci);
	return Py_BuildValue("i", mode);
}
Ejemplo n.º 3
0
gint sci_get_cursor_virtual_space(ScintillaObject *sci)
{
	gint selection_mode = sci_get_selection_mode(sci);

	return selection_mode == SC_SEL_RECTANGLE || selection_mode == SC_SEL_THIN ?
		SSM(sci, SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0) :
		SSM(sci, SCI_GETSELECTIONNCARETVIRTUALSPACE,
			SSM(sci, SCI_GETMAINSELECTION, 0, 0), 0);
}
Ejemplo n.º 4
0
static gboolean can_insert_numbers(void)
{
	GeanyDocument *doc = document_get_current();

	if (doc && !doc->readonly)
	{
		ScintillaObject *sci = doc->editor->sci;

		if (sci_has_selection(sci) && (sci_get_selection_mode(sci) == SC_SEL_RECTANGLE ||
			sci_get_selection_mode(sci) == SC_SEL_THIN))
		{
			start_pos = sci_get_selection_start(sci);
			start_line = sci_get_line_from_position(sci, start_pos);
			end_pos = sci_get_selection_end(sci);
			end_line = sci_get_line_from_position(sci, end_pos);

			return end_line - start_line < MAX_LINES;
		}
	}

	return FALSE;
}