Add 'Move line(s) up/down' keybindings.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4354 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
270a8d8b14
commit
078a9cdc7d
@ -1,3 +1,9 @@
|
||||
2009-10-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* src/keybindings.c, src/keybindings.h, doc/geany.txt, doc/geany.html:
|
||||
Add 'Move line(s) up/down' keybindings.
|
||||
|
||||
|
||||
2009-10-22 Lex Trotman <elextr.at.gmail.dot.com>
|
||||
|
||||
* src/build.c, src/build.h, src/filetypes.h:
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
|
||||
<title>Geany</title>
|
||||
<meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" />
|
||||
<meta name="date" content="2009-10-20" />
|
||||
<meta name="date" content="2009-10-22" />
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
@ -139,7 +139,7 @@ Stylesheet for Geany's documentation based on a version of John Gabriele.
|
||||
<br />Nick Treleaven
|
||||
<br />Frank Lanitz</td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2009-10-20</td></tr>
|
||||
<td>2009-10-22</td></tr>
|
||||
<tr><th class="docinfo-name">Version:</th>
|
||||
<td>0.19</td></tr>
|
||||
</tbody>
|
||||
@ -2843,8 +2843,8 @@ geany.conf file in
|
||||
filetype.xxx file in
|
||||
~/.config/geany/filedefs</p>
|
||||
<p class="last">Saves To:
|
||||
geany.conf file in
|
||||
~/.config/geany</p>
|
||||
filetype.xxx file in
|
||||
~/.config/geany/filedefs</p>
|
||||
</td>
|
||||
<td><p class="first">Loads From:
|
||||
filetype.xxx in
|
||||
@ -2870,9 +2870,9 @@ a whole directory.</li>
|
||||
<li>(Non-Filetype, System Filetype) - although conceptually strange, defining
|
||||
non-filetype commands in a filetype file, this provides the ability to
|
||||
define filetype dependent default menu items.</li>
|
||||
<li>(Execute, Project File) and (Execute, Preferences) - the filetype based execute
|
||||
configuration can only be set by hand editing the appropriate file, see
|
||||
<cite>Preferences File Format</cite> and <cite>Project File Format</cite>.</li>
|
||||
<li>(Execute, Project File) and (Execute, Preferences) - the project filetype based execute
|
||||
configuration and preferences non-filetype based execute can only be set by hand editing the
|
||||
appropriate file, see <cite>Preferences File Format</cite> and <cite>Project File Format</cite>.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section">
|
||||
@ -3240,6 +3240,16 @@ where defined.</td>
|
||||
the currently selected item up to the next word
|
||||
part.</td>
|
||||
</tr>
|
||||
<tr><td>Move line(s) up</td>
|
||||
<td> </td>
|
||||
<td>Move the current line or selected lines up by
|
||||
one line.</td>
|
||||
</tr>
|
||||
<tr><td>Move line(s) down</td>
|
||||
<td> </td>
|
||||
<td>Move the current line or selected lines down by
|
||||
one line.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -5792,7 +5802,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
|
||||
<div class="footer">
|
||||
<hr class="footer" />
|
||||
<a class="reference" href="geany.txt">View document source</a>.
|
||||
Generated on: 2009-10-20 16:54 UTC.
|
||||
Generated on: 2009-10-22 11:20 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
|
||||
</div>
|
||||
|
@ -2921,6 +2921,12 @@ Move cursor in snippet Jumps to the next defi
|
||||
Word part completion Tab When the autocompletion list is visible, complete
|
||||
the currently selected item up to the next word
|
||||
part.
|
||||
|
||||
Move line(s) up Move the current line or selected lines up by
|
||||
one line.
|
||||
|
||||
Move line(s) down Move the current line or selected lines down by
|
||||
one line.
|
||||
=============================== ========================= ==================================================
|
||||
|
||||
|
||||
|
@ -287,6 +287,10 @@ static void init_default_kb(void)
|
||||
GDK_Return, GDK_CONTROL_MASK, "edit_macrolist", _("Show macro list"), NULL);
|
||||
keybindings_set_item(group, GEANY_KEYS_EDITOR_WORDPARTCOMPLETION, NULL,
|
||||
GDK_Tab, 0, "edit_wordpartcompletion", _("Word part completion"), NULL);
|
||||
keybindings_set_item(group, GEANY_KEYS_EDITOR_MOVELINEUP, NULL,
|
||||
0, 0, "edit_movelineup", _("Move line(s) up"), NULL);
|
||||
keybindings_set_item(group, GEANY_KEYS_EDITOR_MOVELINEDOWN, NULL,
|
||||
0, 0, "edit_movelinedown", _("Move line(s) down"), NULL);
|
||||
|
||||
group = ADD_KB_GROUP(CLIPBOARD, _("Clipboard"), cb_func_clipboard_action);
|
||||
|
||||
@ -1963,6 +1967,37 @@ static void delete_lines(GeanyEditor *editor)
|
||||
}
|
||||
|
||||
|
||||
static void move_lines(GeanyEditor *editor, gboolean down)
|
||||
{
|
||||
ScintillaObject *sci = editor->sci;
|
||||
gchar *text;
|
||||
gint pos, line, len;
|
||||
|
||||
sci_start_undo_action(sci);
|
||||
editor_select_lines(editor, TRUE);
|
||||
len = sci_get_selected_text_length(sci);
|
||||
|
||||
pos = sci_get_selection_start(sci);
|
||||
line = sci_get_line_from_position(sci, pos);
|
||||
if (down)
|
||||
line++;
|
||||
else
|
||||
line--;
|
||||
|
||||
text = sci_get_selection_contents(sci);
|
||||
sci_clear(sci);
|
||||
|
||||
pos = sci_get_position_from_line(sci, line);
|
||||
sci_insert_text(sci, pos, text);
|
||||
g_free(text);
|
||||
|
||||
sci_set_current_position(sci, pos, TRUE);
|
||||
sci_set_selection_end(sci, pos + len - 2);
|
||||
|
||||
sci_end_undo_action(sci);
|
||||
}
|
||||
|
||||
|
||||
/* common function for editor keybindings, only valid when scintilla has focus. */
|
||||
static gboolean cb_func_editor_action(guint key_id)
|
||||
{
|
||||
@ -2043,6 +2078,13 @@ static gboolean cb_func_editor_action(guint key_id)
|
||||
}
|
||||
case GEANY_KEYS_EDITOR_WORDPARTCOMPLETION:
|
||||
return editor_complete_word_part(doc->editor);
|
||||
|
||||
case GEANY_KEYS_EDITOR_MOVELINEUP:
|
||||
move_lines(doc->editor, FALSE);
|
||||
break;
|
||||
case GEANY_KEYS_EDITOR_MOVELINEDOWN:
|
||||
move_lines(doc->editor, TRUE);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -149,6 +149,8 @@ enum
|
||||
GEANY_KEYS_EDITOR_MACROLIST,
|
||||
GEANY_KEYS_EDITOR_DELETELINETOEND,
|
||||
GEANY_KEYS_EDITOR_WORDPARTCOMPLETION,
|
||||
GEANY_KEYS_EDITOR_MOVELINEUP,
|
||||
GEANY_KEYS_EDITOR_MOVELINEDOWN,
|
||||
GEANY_KEYS_EDITOR_COUNT
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user