Hi,
As you may have noticed, when cursor is in the "virtual space" (beyond
eoln), our status bar always shows the last "real" column. This small
patch adds a new %v (and %V) format specification, which displays a
"virtual" column number, as if the line extends to the cursor position.
I haven't included sci_get_cursor_virtual_space() is the plugin
interface for now.
Since the virtual position normally requires 3 SSM()-s, and is less
likely to be used than the line and column, I placed the calls into
add_statusbar_statistics() instead of ui_update_statusbar().
--
E-gards: Jimmy
--- ./src/sciwrappers.c.orig 2011-04-05 19:51:03.000000000 +0300
+++ ./src/sciwrappers.c 2011-08-03 17:04:11.000000000 +0300
@@ -394,6 +394,17 @@
}
+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);
+}
+
+
/** Sets the cursor position.
* @param sci Scintilla widget.
* @param position Position.
--- ./src/sciwrappers.h.orig 2011-01-21 20:15:58.000000000 +0200
+++ ./src/sciwrappers.h 2011-08-03 16:51:30.000000000 +0300
@@ -65,6 +65,7 @@
gint sci_get_line_from_position (ScintillaObject *sci, gint position);
gint sci_get_position_from_line (ScintillaObject *sci, gint line);
gint sci_get_current_position (ScintillaObject *sci);
+gint sci_get_cursor_virtual_space(ScintillaObject *sci);
void sci_set_current_position (ScintillaObject *sci, gint position, gboolean scroll_to_caret);
void sci_set_current_line (ScintillaObject *sci, gint line);
--- ./src/ui_utils.c.orig 2011-07-30 14:02:30.000000000 +0300
+++ ./src/ui_utils.c 2011-08-03 19:56:41.000000000 +0300
@@ -196,6 +196,14 @@
case 'C':
g_string_append_printf(stats_str, "%d", col + 1);
break;
+ case 'v':
+ g_string_append_printf(stats_str, "%d",
+ col + sci_get_cursor_virtual_space(doc->editor->sci));
+ break;
+ case 'V':
+ g_string_append_printf(stats_str, "%d",
+ col + sci_get_cursor_virtual_space(doc->editor->sci) + 1);
+ break;
case 's':
g_string_append_printf(stats_str, "%d",
sci_get_selected_text_length(doc->editor->sci) - 1);
_______________________________________________
Geany-devel mailing list
[email protected]
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel