SF.net SVN: geany: [1898] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Mon Sep 24 11:25:41 UTC 2007
Revision: 1898
http://geany.svn.sourceforge.net/geany/?rev=1898&view=rev
Author: ntrel
Date: 2007-09-24 04:25:41 -0700 (Mon, 24 Sep 2007)
Log Message:
-----------
Fix bug with 'Delete lines' when cursor is at the start of a
multi-line selection.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
trunk/src/editor.h
trunk/src/keybindings.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-09-24 06:39:43 UTC (rev 1897)
+++ trunk/ChangeLog 2007-09-24 11:25:41 UTC (rev 1898)
@@ -1,3 +1,10 @@
+2007-09-24 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/keybindings.c, src/editor.c, src/editor.h:
+ Fix bug with 'Delete lines' when cursor is at the start of a
+ multi-line selection.
+
+
2007-09-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/keybindings.c, src/editor.c:
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2007-09-24 06:39:43 UTC (rev 1897)
+++ trunk/src/editor.c 2007-09-24 11:25:41 UTC (rev 1898)
@@ -2315,7 +2315,9 @@
}
-void editor_select_lines(ScintillaObject *sci)
+/* extra_line is for selecting the cursor line or anchor line at the bottom of a selection,
+ * when those lines have no selection. */
+void editor_select_lines(ScintillaObject *sci, gboolean extra_line)
{
gint start, end, line;
@@ -2324,10 +2326,11 @@
start = sci_get_selection_start(sci);
end = sci_get_selection_end(sci);
- if (start != end &&
+ // check if whole lines are already selected
+ if (! extra_line && start != end &&
sci_get_col_from_position(sci, start) == 0 &&
sci_get_col_from_position(sci, end) == 0)
- return; // whole lines already selected
+ return;
line = sci_get_line_from_position(sci, start);
start = sci_get_position_from_line(sci, line);
Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h 2007-09-24 06:39:43 UTC (rev 1897)
+++ trunk/src/editor.h 2007-09-24 11:25:41 UTC (rev 1898)
@@ -128,7 +128,7 @@
void editor_select_word(ScintillaObject *sci);
-void editor_select_lines(ScintillaObject *sci);
+void editor_select_lines(ScintillaObject *sci, gboolean extra_line);
void editor_select_paragraph(ScintillaObject *sci);
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2007-09-24 06:39:43 UTC (rev 1897)
+++ trunk/src/keybindings.c 2007-09-24 11:25:41 UTC (rev 1898)
@@ -1123,7 +1123,7 @@
{
if (sci_get_lines_selected(sci) > 1)
{
- editor_select_lines(sci);
+ editor_select_lines(sci, FALSE); // ignore extra_line because of selecting lines from the line number column
sci_selection_duplicate(sci);
}
else if (sci_can_copy(sci))
@@ -1135,11 +1135,8 @@
static void delete_lines(ScintillaObject *sci)
{
- // include last line (like cut lines, copy lines do):
- sci_set_selection_end(sci, sci_get_selection_end(sci) + 1);
-
- editor_select_lines(sci);
- sci_clear(sci); // SCI_LINEDELETE only does 1 line
+ editor_select_lines(sci, TRUE); // include last line (like cut lines, copy lines do)
+ sci_clear(sci); // (SCI_LINEDELETE only does 1 line)
}
@@ -1215,7 +1212,7 @@
editor_select_word(doc_list[idx].sci);
break;
case GEANY_KEYS_EDIT_SELECTLINE:
- editor_select_lines(doc_list[idx].sci);
+ editor_select_lines(doc_list[idx].sci, FALSE);
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.
More information about the Commits
mailing list