Add 'Insert New Line Before/After Current' keybindings (based on
patch by Eugene Arshinov, thanks). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5297 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
6a012dd73e
commit
9e1ff83085
@ -5,6 +5,9 @@
|
||||
* tagmanager/c.c:
|
||||
Ignore D unittest blocks.
|
||||
Parse D template functions with constraints.
|
||||
* src/keybindings.c, src/keybindings.h, doc/geany.txt, doc/geany.html:
|
||||
Add 'Insert New Line Before/After Current' keybindings (based on
|
||||
patch by Eugene Arshinov, thanks).
|
||||
|
||||
|
||||
2010-10-08 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
@ -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="2010-10-04" />
|
||||
<meta name="date" content="2010-10-07" />
|
||||
<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>2010-10-04</td></tr>
|
||||
<td>2010-10-07</td></tr>
|
||||
<tr><th class="docinfo-name">Version:</th>
|
||||
<td>0.20</td></tr>
|
||||
</tbody>
|
||||
@ -3518,6 +3518,14 @@ be used for indentation and inserts space
|
||||
characters of the amount of a tab width when
|
||||
tabs should be used for indentation.</td>
|
||||
</tr>
|
||||
<tr><td>Insert New Line Before Current</td>
|
||||
<td> </td>
|
||||
<td>Inserts a new line with indentation.</td>
|
||||
</tr>
|
||||
<tr><td>Insert New Line After Current</td>
|
||||
<td> </td>
|
||||
<td>Inserts a new line with indentation.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -6256,7 +6264,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: 2010-10-07 14:02 UTC.
|
||||
Generated on: 2010-10-15 17:13 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>
|
||||
|
||||
@ -3102,6 +3102,10 @@ Insert alternative whitespace Inserts a tab characte
|
||||
be used for indentation and inserts space
|
||||
characters of the amount of a tab width when
|
||||
tabs should be used for indentation.
|
||||
|
||||
Insert New Line Before Current Inserts a new line with indentation.
|
||||
|
||||
Insert New Line After Current Inserts a new line with indentation.
|
||||
=============================== ========================= ==================================================
|
||||
|
||||
|
||||
|
||||
@ -372,6 +372,10 @@ static void init_default_kb(void)
|
||||
LW(insert_date_custom1));
|
||||
keybindings_set_item(group, GEANY_KEYS_INSERT_ALTWHITESPACE, NULL,
|
||||
0, 0, "edit_insertwhitespace", _("_Insert Alternative White Space"), NULL);
|
||||
keybindings_set_item(group, GEANY_KEYS_INSERT_LINEBEFORE, NULL,
|
||||
0, 0, "edit_insertlinebefore", _("Insert New Line Before Current"), NULL);
|
||||
keybindings_set_item(group, GEANY_KEYS_INSERT_LINEAFTER, NULL,
|
||||
0, 0, "edit_insertlineafter", _("Insert New Line After Current"), NULL);
|
||||
|
||||
group = ADD_KB_GROUP(SETTINGS, _("Settings"), NULL);
|
||||
|
||||
@ -2537,6 +2541,27 @@ static gboolean cb_func_document_action(guint key_id)
|
||||
}
|
||||
|
||||
|
||||
static void insert_line_after(GeanyEditor *editor)
|
||||
{
|
||||
ScintillaObject *sci = editor->sci;
|
||||
|
||||
sci_send_command(sci, SCI_LINEEND);
|
||||
sci_send_command(sci, SCI_NEWLINE);
|
||||
}
|
||||
|
||||
|
||||
static void insert_line_before(GeanyEditor *editor)
|
||||
{
|
||||
ScintillaObject *sci = editor->sci;
|
||||
gint line = sci_get_current_line(sci);
|
||||
gint indentpos = sci_get_line_indent_position(sci, line);
|
||||
|
||||
sci_set_current_position(sci, indentpos, TRUE);
|
||||
sci_send_command(sci, SCI_NEWLINE);
|
||||
sci_send_command(sci, SCI_LINEUP);
|
||||
}
|
||||
|
||||
|
||||
/* common function for insert keybindings, only valid when scintilla has focus. */
|
||||
static gboolean cb_func_insert_action(guint key_id)
|
||||
{
|
||||
@ -2556,6 +2581,12 @@ static gboolean cb_func_insert_action(guint key_id)
|
||||
gtk_menu_item_activate(GTK_MENU_ITEM(
|
||||
ui_lookup_widget(main_widgets.window, "insert_date_custom1")));
|
||||
break;
|
||||
case GEANY_KEYS_INSERT_LINEAFTER:
|
||||
insert_line_after(doc->editor);
|
||||
break;
|
||||
case GEANY_KEYS_INSERT_LINEBEFORE:
|
||||
insert_line_before(doc->editor);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -236,6 +236,8 @@ enum GeanyKeyBindingID
|
||||
GEANY_KEYS_FILE_OPENLASTTAB, /**< Keybinding. */
|
||||
GEANY_KEYS_SEARCH_FINDINFILES, /**< Keybinding. */
|
||||
GEANY_KEYS_GOTO_NEXTWORDPART, /**< Keybinding. */
|
||||
GEANY_KEYS_INSERT_LINEAFTER, /**< Keybinding. */
|
||||
GEANY_KEYS_INSERT_LINEBEFORE, /**< Keybinding. */
|
||||
GEANY_KEYS_COUNT /* must not be used by plugins */
|
||||
};
|
||||
|
||||
@ -273,4 +275,3 @@ void keybindings_show_shortcuts(void);
|
||||
gboolean keybindings_check_event(GdkEventKey *ev, GeanyKeyBinding *kb);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user