draw_cursor (text, FALSE);
}
+void
+gtk_stext_compact_buffer (GtkSText *text)
+{
+ GtkEditable *editable = GTK_EDITABLE (text);
+
+ g_return_if_fail (text != NULL);
+ g_return_if_fail (GTK_IS_STEXT (text));
+ move_gap (text, gtk_stext_get_length(text));
+}
+
void
gtk_stext_insert (GtkSText *text,
GdkFont *font,
switch (event->keyval)
{
case GDK_Home:
- if (event->state & GDK_CONTROL_MASK)
- move_cursor_buffer_ver (text, -1);
+ if (event->state & GDK_CONTROL_MASK) {
+ if (text->wrap_rmargin == 0) {
+ /* SYLPHEED: old behaviour */
+ move_cursor_buffer_ver (text, -1);
+ }
+ else {
+ /* SYLPHEED: contrived, but "trusty" */
+ move_cursor_buffer_ver(text, -1);
+ move_cursor_to_display_row_start(text);
+ }
+ }
else {
if (text->wrap_rmargin > 0) {
/* SYLPHEED: line start */
}
break;
case GDK_End:
- if (event->state & GDK_CONTROL_MASK)
- move_cursor_buffer_ver (text, +1);
+ if (event->state & GDK_CONTROL_MASK) {
+ /* SYLPHEED: a little bit contrived... */
+ if (text->wrap_rmargin == 0) {
+ /* old behaviour */
+ move_cursor_buffer_ver (text, +1);
+ }
+ else {
+ move_cursor_buffer_ver(text, +1);
+ move_cursor_to_display_row_end(text);
+ }
+ }
else {
if (text->wrap_rmargin > 0) {
/* SYLPHEED: line end */
break;
case GDK_Down:
move_cursor_to_display_row_down(text);
-// move_cursor_ver (text, +1);
+/* move_cursor_ver (text, +1); */
break;
case GDK_Left:
if (event->state & GDK_CONTROL_MASK)
}
/* dumb */
-static gboolean range_intersect(gint x1, gint x2, gint y1, gint y2)
+static gboolean range_intersect(guint x1, guint x2, guint y1, guint y2)
{
- gint tmp;
+ guint tmp;
if (x1 > x2) { tmp = x1; x1 = x2; x2 = tmp; }
if (y1 > y2) { tmp = y1; y1 = y2; y1 = tmp; }
if (y1 < x1) { tmp = x1; x1 = y1; y1 = tmp; tmp = x2; x2 = y2; y2 = tmp; }
int new_index;
int col;
GtkSPropertyMark mark;
-
+
mark = find_this_line_start_mark(text, text->cursor_mark.index, &text->cursor_mark);
/* top of buffer */
if (mark.index == 0) {
- XDEBUG ( ("%s(%d) top of buffer", __FILE__, __LINE__) );
- return;
+ XDEBUG ( ("%s(%d) top of buffer", __FILE__, __LINE__) );
}
- /* we need to previous DISPLAY row not the previous BUFFER line, so we go one line back,
- * and iterate over the lines until we have a LineParams that matches the original */
-
+ /* we need previous DISPLAY row not the previous BUFFER line, so we go to start
+ * of paragraph, and iterate over the lines until we have a LineParams that matches
+ * the original */
lp = CACHE_DATA(text->current_line);
col = (text->cursor_mark.index - lp.start.index);
data.start = lp.start.index;
data.end = lp.end.index;
/* get the previous line */
- if (mark.index - 1 > 0) {
+ if (mark.index != 0) {
decrement_mark(&mark);
- XDEBUG( ("%s(%d) mark decrement", __FILE__, __LINE__) );
- if (mark.index - 1 > 0) {
+ if (mark.index != 0) {
GtkSPropertyMark smark = mark;
XDEBUG( ("%s(%d) finding line start mark", __FILE__, __LINE__) );
mark = find_this_line_start_mark(text, smark.index -1, &smark);
LineParams lp;
} fdrf;
+#if defined(AHX_DEBUG)
+static void print_line(GtkSText *text, guint start, guint end)
+{
+ gchar *buf = alloca(2048), *walk = buf;
+
+ memset(buf, 0, 2048);
+ for (; start <= end; start++) {
+ *walk++ = GTK_STEXT_INDEX(text, start);
+ }
+ XDEBUG( ("%s", buf) );
+}
+#endif
+
static gint forward_display_row_fetcher(GtkSText *text,
LineParams *lp,
fdrf *data)
__FILE__, __LINE__, data->start, data->end, lp->start.index, lp->end.index) );
data->lp = *lp;
data->completed = TRUE;
+ print_line(text, lp->start.index, lp->end.index);
return TRUE;
}
else if (range_intersect(data->start, data->end, lp->start.index, lp->end.index)) {
new_index = data.lp.end.index;
}
/* and move the cursor */
+ XDEBUG( ("%s(%d) - FW set pos %d", __FILE__, __LINE__, new_index) );
gtk_stext_set_position_X(GTK_EDITABLE(text), new_index);
}
}