rewrite_reflow: Create sci_get_position_from_col function to wrap Scintilla's SCI_FINDCOLUMN command.

This commit is contained in:
Eugene Arshinov 2012-03-26 15:49:55 +04:00 committed by elextr
parent 390646a412
commit 40fb3aa64d
3 changed files with 8 additions and 1 deletions

View File

@ -599,7 +599,7 @@ static void check_line_breaking(GeanyEditor *editor, gint pos, gchar c)
last_pos = sci_get_line_end_position(sci, line);
last_col = sci_get_col_from_position(sci, last_pos); /* get last column on line */
/* last column - distance is the desired column, then retrieve its document position */
pos = SSM(sci, SCI_FINDCOLUMN, line, last_col - diff);
pos = sci_get_position_from_col(sci, line, last_col - diff);
sci_set_current_position(sci, pos, FALSE);
sci_scroll_caret(sci);
return;

View File

@ -375,6 +375,12 @@ gint sci_get_col_from_position(ScintillaObject *sci, gint position)
}
gint sci_get_position_from_col(ScintillaObject *sci, gint line, gint col)
{
return (gint) SSM(sci, SCI_FINDCOLUMN, line, col);
}
/** Gets the position for the start of @a line.
* @param sci Scintilla widget.
* @param line Line.

View File

@ -60,6 +60,7 @@ gint sci_marker_next (ScintillaObject *sci, gint line, gint marker_mask, g
gint sci_marker_previous (ScintillaObject *sci, gint line, gint marker_mask, gboolean wrap);
gint sci_get_col_from_position (ScintillaObject *sci, gint position);
gint sci_get_position_from_col (ScintillaObject *sci, gint line, gint col);
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);