SF.net SVN: geany: [1894] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Sat Sep 22 11:11:24 UTC 2007
Revision: 1894
http://geany.svn.sourceforge.net/geany/?rev=1894&view=rev
Author: ntrel
Date: 2007-09-22 04:11:24 -0700 (Sat, 22 Sep 2007)
Log Message:
-----------
Undo r1891 so that 'Delete lines' again includes the cursor line
even when at the start of a line - like Cut/Copy lines do.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
trunk/src/keybindings.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-09-21 17:29:55 UTC (rev 1893)
+++ trunk/ChangeLog 2007-09-22 11:11:24 UTC (rev 1894)
@@ -1,6 +1,15 @@
-2007-09-20 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+2007-09-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+ * src/keybindings.c, src/editor.c:
+ Undo r1891 so that 'Delete lines' again includes the cursor line
+ even when at the start of a line - like Cut/Copy lines do.
+
+
+2007-09-21 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
* src/editor.c:
+ Make 'Select lines' not include an extra line when whole lines are
+ selected.
Make 'Delete lines' not include an extra line when whole lines are
selected.
* src/keybindings.c, src/callbacks.c:
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2007-09-21 17:29:55 UTC (rev 1893)
+++ trunk/src/editor.c 2007-09-22 11:11:24 UTC (rev 1894)
@@ -2317,21 +2317,24 @@
void editor_select_lines(ScintillaObject *sci)
{
- gint start, end;
+ gint start, end, line;
g_return_if_fail(sci != NULL);
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);
- if (start == end || sci_get_col_from_position(sci, end) > 0) // partially selected line
- {
- gint line = sci_get_line_from_position(sci, end);
- end = sci_get_position_from_line(sci, line + 1);
- }
+ if (start != end &&
+ sci_get_col_from_position(sci, start) == 0 &&
+ sci_get_col_from_position(sci, end) == 0)
+ return; // whole lines already selected
+
+ line = sci_get_line_from_position(sci, start);
+ start = sci_get_position_from_line(sci, line);
+
+ line = sci_get_line_from_position(sci, end);
+ end = sci_get_position_from_line(sci, line + 1);
+
SSM(sci, SCI_SETSEL, start, end);
}
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2007-09-21 17:29:55 UTC (rev 1893)
+++ trunk/src/keybindings.c 2007-09-22 11:11:24 UTC (rev 1894)
@@ -1119,7 +1119,7 @@
}
-static void duplicate_line(ScintillaObject *sci)
+static void duplicate_lines(ScintillaObject *sci)
{
if (sci_get_lines_selected(sci) > 1)
{
@@ -1133,6 +1133,16 @@
}
+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
+}
+
+
// common function for editing keybindings, only valid when scintilla has focus.
static void cb_func_edit(guint key_id)
{
@@ -1154,12 +1164,10 @@
sci_cmd(doc_list[idx].sci, SCI_LINESCROLLDOWN);
break;
case GEANY_KEYS_EDIT_DUPLICATELINE:
- duplicate_line(doc_list[idx].sci);
+ duplicate_lines(doc_list[idx].sci);
break;
case GEANY_KEYS_EDIT_DELETELINE:
- // SCI_LINEDELETE only does 1 line
- editor_select_lines(doc_list[idx].sci);
- sci_clear(doc_list[idx].sci);
+ delete_lines(doc_list[idx].sci);
break;
case GEANY_KEYS_EDIT_COPYLINE:
sci_cmd(doc_list[idx].sci, SCI_LINECOPY);
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