Revision: 5297 http://geany.svn.sourceforge.net/geany/?rev=5297&view=rev Author: ntrel Date: 2010-10-15 17:15:13 +0000 (Fri, 15 Oct 2010)
Log Message: ----------- Add 'Insert New Line Before/After Current' keybindings (based on patch by Eugene Arshinov, thanks).
Modified Paths: -------------- trunk/ChangeLog trunk/doc/geany.html trunk/doc/geany.txt trunk/src/keybindings.c trunk/src/keybindings.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-10-15 16:04:38 UTC (rev 5296) +++ trunk/ChangeLog 2010-10-15 17:15:13 UTC (rev 5297) @@ -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>
Modified: trunk/doc/geany.html =================================================================== --- trunk/doc/geany.html 2010-10-15 16:04:38 UTC (rev 5296) +++ trunk/doc/geany.html 2010-10-15 17:15:13 UTC (rev 5297) @@ -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 @@ <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 @@ 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 @@ <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>
Modified: trunk/doc/geany.txt =================================================================== --- trunk/doc/geany.txt 2010-10-15 16:04:38 UTC (rev 5296) +++ trunk/doc/geany.txt 2010-10-15 17:15:13 UTC (rev 5297) @@ -3102,6 +3102,10 @@ 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. =============================== ========================= ==================================================
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2010-10-15 16:04:38 UTC (rev 5296) +++ trunk/src/keybindings.c 2010-10-15 17:15:13 UTC (rev 5297) @@ -372,6 +372,10 @@ 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 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 @@ 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; }
Modified: trunk/src/keybindings.h =================================================================== --- trunk/src/keybindings.h 2010-10-15 16:04:38 UTC (rev 5296) +++ trunk/src/keybindings.h 2010-10-15 17:15:13 UTC (rev 5297) @@ -236,6 +236,8 @@ 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 @@ gboolean keybindings_check_event(GdkEventKey *ev, GeanyKeyBinding *kb);
#endif -
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.