Revision: 1782 http://geany.svn.sourceforge.net/geany/?rev=1782&view=rev Author: ntrel Date: 2007-08-10 04:29:37 -0700 (Fri, 10 Aug 2007)
Log Message: ----------- Make 'Delete current line' and 'Select current line' work for all lines that have a selection. Implement 'Copy current line'.
Modified Paths: -------------- trunk/ChangeLog trunk/src/editor.c trunk/src/editor.h trunk/src/keybindings.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-08-09 22:29:31 UTC (rev 1781) +++ trunk/ChangeLog 2007-08-10 11:29:37 UTC (rev 1782) @@ -1,3 +1,11 @@ +2007-08-10 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/keybindings.c, src/editor.c, src/editor.h: + Make 'Delete current line' and 'Select current line' work for all + lines that have a selection. + Implement 'Copy current line'. + + 2007-08-10 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* tagmanager/php.c: Fix parsing classes with modifiers like 'final'.
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2007-08-09 22:29:31 UTC (rev 1781) +++ trunk/src/editor.c 2007-08-10 11:29:37 UTC (rev 1782) @@ -2297,18 +2297,19 @@ }
-void editor_select_line(ScintillaObject *sci) +void editor_select_lines(ScintillaObject *sci) { - gint pos, line, start, end; + gint start, end;
g_return_if_fail(sci != NULL);
- pos = SSM(sci, SCI_GETCURRENTPOS, 0, 0); - line = SSM(sci, SCI_LINEFROMPOSITION, pos, 0); + start = sci_get_selection_start(sci); + start = sci_get_line_from_position(sci, start); + start = sci_get_position_from_line(sci, start); + end = sci_get_selection_end(sci); + end = sci_get_line_from_position(sci, end); + end = sci_get_position_from_line(sci, end + 1);
- start = SSM(sci, SCI_POSITIONFROMLINE, line, TRUE); - end = SSM(sci, SCI_POSITIONFROMLINE, line + 1, TRUE); - SSM(sci, SCI_SETSEL, start, end); }
Modified: trunk/src/editor.h =================================================================== --- trunk/src/editor.h 2007-08-09 22:29:31 UTC (rev 1781) +++ trunk/src/editor.h 2007-08-10 11:29:37 UTC (rev 1782) @@ -137,7 +137,7 @@
void editor_select_word(ScintillaObject *sci);
-void editor_select_line(ScintillaObject *sci); +void editor_select_lines(ScintillaObject *sci);
void editor_select_paragraph(ScintillaObject *sci);
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2007-08-09 22:29:31 UTC (rev 1781) +++ trunk/src/keybindings.c 2007-08-10 11:29:37 UTC (rev 1782) @@ -245,11 +245,11 @@ keys[GEANY_KEYS_EDIT_DUPLICATELINE] = fill(cb_func_edit, GDK_d, GDK_CONTROL_MASK, "edit_duplicateline", _("Duplicate line or selection")); keys[GEANY_KEYS_EDIT_DELETELINE] = fill(cb_func_edit, - GDK_k, GDK_CONTROL_MASK, "edit_deleteline", _("Delete current line")); + GDK_k, GDK_CONTROL_MASK, "edit_deleteline", _("Delete current line(s)")); keys[GEANY_KEYS_EDIT_COPYLINE] = fill(cb_func_edit, - GDK_k, GDK_MOD1_MASK | GDK_SHIFT_MASK, "edit_copyline", _("Copy current line")); + GDK_k, GDK_MOD1_MASK | GDK_SHIFT_MASK, "edit_copyline", _("Copy current line(s)")); keys[GEANY_KEYS_EDIT_CUTLINE] = fill(cb_func_edit, - GDK_k, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "edit_cutline", _("Cut current line")); + GDK_k, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "edit_cutline", _("Cut current line(s)")); keys[GEANY_KEYS_EDIT_TRANSPOSELINE] = fill(cb_func_edit, GDK_t, GDK_CONTROL_MASK, "edit_transposeline", _("Transpose current line")); keys[GEANY_KEYS_EDIT_TOLOWERCASE] = fill(cb_func_edit, @@ -305,7 +305,7 @@ keys[GEANY_KEYS_EDIT_SELECTWORD] = fill(cb_func_edit, GDK_w, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectword", _("Select current word")); keys[GEANY_KEYS_EDIT_SELECTLINE] = fill(cb_func_edit, - GDK_l, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectline", _("Select current line")); + GDK_l, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectline", _("Select current line(s)")); keys[GEANY_KEYS_EDIT_SELECTPARAGRAPH] = fill(cb_func_edit, GDK_p, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectparagraph", _("Select current paragraph")); keys[GEANY_KEYS_EDIT_SCROLLTOLINE] = fill(cb_func_edit, @@ -1106,8 +1106,13 @@ on_menu_duplicate_line1_activate(NULL, NULL); break; case GEANY_KEYS_EDIT_DELETELINE: - sci_cmd(doc_list[idx].sci, SCI_LINEDELETE); + // SCI_LINEDELETE only does 1 line + editor_select_lines(doc_list[idx].sci); + sci_clear(doc_list[idx].sci); break; + case GEANY_KEYS_EDIT_COPYLINE: + sci_cmd(doc_list[idx].sci, SCI_LINECOPY); + break; case GEANY_KEYS_EDIT_CUTLINE: sci_cmd(doc_list[idx].sci, SCI_LINECUT); break; @@ -1151,7 +1156,7 @@ editor_select_word(doc_list[idx].sci); break; case GEANY_KEYS_EDIT_SELECTLINE: - editor_select_line(doc_list[idx].sci); + editor_select_lines(doc_list[idx].sci); break; case GEANY_KEYS_EDIT_SELECTPARAGRAPH: editor_select_paragraph(doc_list[idx].sci);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.