Made Duplicate Line command duplicate selection if present

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@453 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2006-06-17 15:39:47 +00:00
parent e885f520ed
commit 0c9a5af71e
5 changed files with 21 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2006-06-17 Nick Treleaven <nick.treleaven@btinternet.com>
* src/keybindings.c, src/sciwrappers.c, src/sciwrappers.h,
doc/geany.docbook: Made Duplicate Line command duplicate selection
if present.
2006-06-16 Enrico Troeger <enrico.troeger@uvena.de>
* src/build.c: Delete all indicators when starting a new compilation.

View File

@ -933,8 +933,8 @@
<entry align="left" spanname="hspan">Editing operations</entry>
</row>
<row>
<entry>Duplicate line</entry>
<entry>Duplicates the current line.</entry>
<entry>Duplicate line or selection</entry>
<entry>Duplicates the current line or selection.</entry>
</row>
<row>
<entry>Comment line</entry>

View File

@ -133,7 +133,7 @@ void keybindings_init(void)
keys[GEANY_KEYS_SWITCH_TABLEFT] = fill(cb_func_switch_tableft, 0, 0, "switch_tableft", _("Switch to left document"));
keys[GEANY_KEYS_SWITCH_TABRIGHT] = fill(cb_func_switch_tabright, 0, 0, "switch_tabright", _("Switch to right document"));
keys[GEANY_KEYS_TOOGLE_SIDEBAR] = fill(cb_func_toggle_sidebar, 0, 0, "toggle_sidebar", _("Toggle sidebar"));
keys[GEANY_KEYS_EDIT_DUPLICATELINE] = fill(cb_func_edit_duplicateline, GDK_g, GDK_CONTROL_MASK, "edit_duplicateline", _("Duplicate line"));
keys[GEANY_KEYS_EDIT_DUPLICATELINE] = fill(cb_func_edit_duplicateline, GDK_g, GDK_CONTROL_MASK, "edit_duplicateline", _("Duplicate line or selection"));
keys[GEANY_KEYS_EDIT_COMMENTLINE] = fill(cb_func_edit_commentline, GDK_d, GDK_CONTROL_MASK, "edit_commentline", _("Comment line"));
keys[GEANY_KEYS_EDIT_AUTOCOMPLETE] = fill(cb_func_edit_autocomplete, GDK_space, GDK_CONTROL_MASK, "edit_autocomplete", _("Complete word"));
keys[GEANY_KEYS_EDIT_CALLTIP] = fill(cb_func_edit_calltip, GDK_space, GDK_MOD1_MASK, "edit_calltip", _("Show calltip"));
@ -512,7 +512,10 @@ static void cb_func_toggle_sidebar(void)
static void cb_func_edit_duplicateline(void)
{
gint idx = document_get_cur_idx();
sci_line_duplicate(doc_list[idx].sci);
if (sci_can_copy(doc_list[idx].sci))
sci_selection_duplicate(doc_list[idx].sci);
else
sci_line_duplicate(doc_list[idx].sci);
}
static void cb_func_edit_commentline(void)

View File

@ -704,6 +704,12 @@ void sci_line_duplicate(ScintillaObject *sci)
}
void sci_selection_duplicate(ScintillaObject *sci)
{
SSM(sci, SCI_SELECTIONDUPLICATE, 0, 0);
}
void sci_insert_text(ScintillaObject *sci, gint pos, const gchar *text)
{
SSM(sci, SCI_INSERTTEXT, pos, (sptr_t) text);

View File

@ -129,6 +129,7 @@ void sci_set_codepage (ScintillaObject * sci, gint cp);
void sci_clear_cmdkey (ScintillaObject * sci, gint key);
void sci_assign_cmdkey (ScintillaObject * sci, gint key, gint command);
void sci_get_text_range (ScintillaObject * sci, gint start, gint end, gchar *text);
void sci_selection_duplicate (ScintillaObject * sci);
void sci_line_duplicate (ScintillaObject * sci);
void sci_insert_text (ScintillaObject * sci, gint pos, const gchar *text);
void sci_grap_focus (ScintillaObject * sci);