Undo r1891 so that 'Delete lines' again includes the cursor line
even when at the start of a line - like Cut/Copy lines do. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1894 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
3baa7d8fc3
commit
1c68618e6a
11
ChangeLog
11
ChangeLog
@ -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:
|
* 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
|
Make 'Delete lines' not include an extra line when whole lines are
|
||||||
selected.
|
selected.
|
||||||
* src/keybindings.c, src/callbacks.c:
|
* src/keybindings.c, src/callbacks.c:
|
||||||
|
|||||||
21
src/editor.c
21
src/editor.c
@ -2317,21 +2317,24 @@ void editor_select_word(ScintillaObject *sci)
|
|||||||
|
|
||||||
void editor_select_lines(ScintillaObject *sci)
|
void editor_select_lines(ScintillaObject *sci)
|
||||||
{
|
{
|
||||||
gint start, end;
|
gint start, end, line;
|
||||||
|
|
||||||
g_return_if_fail(sci != NULL);
|
g_return_if_fail(sci != NULL);
|
||||||
|
|
||||||
start = sci_get_selection_start(sci);
|
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_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);
|
SSM(sci, SCI_SETSEL, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1119,7 +1119,7 @@ static void cb_func_edit_global(guint key_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void duplicate_line(ScintillaObject *sci)
|
static void duplicate_lines(ScintillaObject *sci)
|
||||||
{
|
{
|
||||||
if (sci_get_lines_selected(sci) > 1)
|
if (sci_get_lines_selected(sci) > 1)
|
||||||
{
|
{
|
||||||
@ -1133,6 +1133,16 @@ static void duplicate_line(ScintillaObject *sci)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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.
|
// common function for editing keybindings, only valid when scintilla has focus.
|
||||||
static void cb_func_edit(guint key_id)
|
static void cb_func_edit(guint key_id)
|
||||||
{
|
{
|
||||||
@ -1154,12 +1164,10 @@ static void cb_func_edit(guint key_id)
|
|||||||
sci_cmd(doc_list[idx].sci, SCI_LINESCROLLDOWN);
|
sci_cmd(doc_list[idx].sci, SCI_LINESCROLLDOWN);
|
||||||
break;
|
break;
|
||||||
case GEANY_KEYS_EDIT_DUPLICATELINE:
|
case GEANY_KEYS_EDIT_DUPLICATELINE:
|
||||||
duplicate_line(doc_list[idx].sci);
|
duplicate_lines(doc_list[idx].sci);
|
||||||
break;
|
break;
|
||||||
case GEANY_KEYS_EDIT_DELETELINE:
|
case GEANY_KEYS_EDIT_DELETELINE:
|
||||||
// SCI_LINEDELETE only does 1 line
|
delete_lines(doc_list[idx].sci);
|
||||||
editor_select_lines(doc_list[idx].sci);
|
|
||||||
sci_clear(doc_list[idx].sci);
|
|
||||||
break;
|
break;
|
||||||
case GEANY_KEYS_EDIT_COPYLINE:
|
case GEANY_KEYS_EDIT_COPYLINE:
|
||||||
sci_cmd(doc_list[idx].sci, SCI_LINECOPY);
|
sci_cmd(doc_list[idx].sci, SCI_LINECOPY);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user