[gtkhtml] Bug #586076 - [external-editor] Pass cursor pos to vim - new API



commit 64dc631be4c833a9e517db6f6b5d8af4ddc128d2
Author: Milan Crha <mcrha redhat com>
Date:   Fri Aug 7 18:45:02 2009 +0200

    Bug #586076 - [external-editor] Pass cursor pos to vim - new API

 gtkhtml/gtkhtml.c |   20 ++++++++++++++++++++
 gtkhtml/gtkhtml.h |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/gtkhtml/gtkhtml.c b/gtkhtml/gtkhtml.c
index a91dc8a..6aa0cef 100644
--- a/gtkhtml/gtkhtml.c
+++ b/gtkhtml/gtkhtml.c
@@ -6435,6 +6435,26 @@ gtk_html_set_tokenizer (GtkHTML *html, HTMLTokenizer *tokenizer)
 	html_engine_set_tokenizer (html->engine, tokenizer);
 }
 
+gboolean
+gtk_html_get_cursor_pos (GtkHTML *html, gint *position, gint *offset)
+{
+	gboolean read = FALSE;
+
+	g_return_val_if_fail (html != NULL, FALSE);
+	g_return_val_if_fail (GTK_IS_HTML (html), FALSE);
+
+	if (html->engine && html->engine->cursor) {
+		read = TRUE;
+
+		if (position)
+			*position = html->engine->cursor->position;
+		if (offset)
+			*offset = html->engine->cursor->offset;
+	}
+
+	return read;
+}
+
 gchar *
 gtk_html_filename_from_uri (const gchar *uri)
 {
diff --git a/gtkhtml/gtkhtml.h b/gtkhtml/gtkhtml.h
index 8aa34cd..9f2c5d3 100644
--- a/gtkhtml/gtkhtml.h
+++ b/gtkhtml/gtkhtml.h
@@ -332,6 +332,8 @@ gchar *                     gtk_html_get_cursor_image_src          (GtkHTML
 void                       gtk_html_set_tokenizer                 (GtkHTML                   *html,
 								   HTMLTokenizer             *tokenizer);
 
+gboolean		   gtk_html_get_cursor_pos		  (GtkHTML *html, gint *position, gint *offset);
+
 /* DEPRECATED */
 #if 1
 gboolean                   gtk_html_build_with_gconf              (void);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]