Use Ctrl+Shift+Space always for showing calltips because Alt+Space is used often by window managers (not only under Windows).

Added keybinding for inserting alternative whitespace characters.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1422 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-03-25 20:51:45 +00:00
parent 51b4f03a2d
commit b187533760
8 changed files with 47 additions and 13 deletions

View File

@ -1,3 +1,12 @@
2007-03-25 Enrico Tröger <enrico.troeger@uvena.de>
* doc/geany.docbook, src/keybindings.c, src/keybindings.h,
src/sci_cb.c, src/sci_cb.h, src/utils.c, src/utils.h:
Use Ctrl+Shift+Space always for showing calltips because Alt+Space is
used often by window managers (not only under Windows).
Added keybinding for inserting alternative whitespace characters.
2007-03-24 Nick Treleaven <nick.treleaven@btinternet.com>
* src/sci_cb.c, src/symbols.c:

View File

@ -1514,6 +1514,14 @@
<entry>Selects the current word under the cursor.
</entry>
</row>
<row>
<entry>Insert alternative whitespace</entry>
<entry>Inserts a tabulator character when spaces should be used for
indentation and inserts space characters of the amount of a
tabulator width when tabulators should be used for
indentation.
</entry>
</row>
<row>
<entry>Find Usage</entry>
<entry>Finds all occurrences of the current word (near the

View File

@ -250,14 +250,8 @@ void keybindings_init(void)
_("Goto previous marker"));
keys[GEANY_KEYS_EDIT_AUTOCOMPLETE] = fill(cb_func_edit,
GDK_space, GDK_CONTROL_MASK, "edit_autocomplete", _("Complete word"));
#ifdef G_OS_WIN32
// on windows alt-space is taken by the window manager
keys[GEANY_KEYS_EDIT_CALLTIP] = fill(cb_func_edit,
GDK_space, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "edit_calltip", _("Show calltip"));
#else
keys[GEANY_KEYS_EDIT_CALLTIP] = fill(cb_func_edit,
GDK_space, GDK_MOD1_MASK, "edit_calltip", _("Show calltip"));
#endif
keys[GEANY_KEYS_EDIT_MACROLIST] = fill(cb_func_edit,
GDK_Return, GDK_CONTROL_MASK, "edit_macrolist", _("Show macro list"));
keys[GEANY_KEYS_EDIT_SUPPRESSCOMPLETION] = fill(cb_func_edit,
@ -266,6 +260,9 @@ void keybindings_init(void)
keys[GEANY_KEYS_EDIT_SELECTWORD] = fill(cb_func_edit,
0, 0, "edit_selectword", _("Select current word"));
keys[GEANY_KEYS_EDIT_INSERTALTWHITESPACE] = fill(cb_func_edit,
0, 0, "edit_insertwhitespace", _("Insert alternative whitespace"));
keys[GEANY_KEYS_POPUP_FINDUSAGE] = fill(cb_func_current_word,
0, 0, "popup_findusage", _("Find Usage"));
keys[GEANY_KEYS_POPUP_GOTOTAGDEFINITION] = fill(cb_func_current_word,
@ -948,6 +945,9 @@ static void cb_func_edit(guint key_id)
case GEANY_KEYS_EDIT_SELECTWORD:
sci_cb_select_word(doc_list[idx].sci);
break;
case GEANY_KEYS_EDIT_INSERTALTWHITESPACE:
sci_cb_insert_alternative_whitespace(doc_list[idx].sci);
break;
case GEANY_KEYS_EDIT_INCREASEINDENT:
on_menu_increase_indent1_activate(NULL, NULL);
break;

View File

@ -113,6 +113,7 @@ enum
GEANY_KEYS_EDIT_MACROLIST,
GEANY_KEYS_EDIT_SUPPRESSCOMPLETION,
GEANY_KEYS_EDIT_SELECTWORD,
GEANY_KEYS_EDIT_INSERTALTWHITESPACE,
GEANY_KEYS_POPUP_FINDUSAGE,
GEANY_KEYS_POPUP_GOTOTAGDEFINITION,
GEANY_KEYS_POPUP_GOTOTAGDECLARATION,

View File

@ -347,7 +347,7 @@ static void on_new_line_added(ScintillaObject *sci, gint idx)
sci_get_style_at(sci, pos - 2) == SCE_P_OPERATOR)
{
// creates and inserts one tabulator sign or whitespace of the amount of the tab width
gchar *text = utils_get_whitespace(app->pref_editor_tab_width);
gchar *text = utils_get_whitespace(app->pref_editor_tab_width, FALSE);
sci_add_text(sci, text);
g_free(text);
}
@ -993,7 +993,7 @@ void sci_cb_auto_forif(gint idx, gint pos)
}
// get the whitespace for additional indentation
space = utils_get_whitespace(app->pref_editor_tab_width);
space = utils_get_whitespace(app->pref_editor_tab_width, FALSE);
space_len = strlen(space);
// "pattern", buf + x, y -> x + y = 15, because buf is (pos - 16)...(pos - 1) = 15
@ -2144,6 +2144,15 @@ static void scroll_to_line(ScintillaObject *sci, gint line, gfloat percent_of_vi
}
void sci_cb_insert_alternative_whitespace(ScintillaObject *sci)
{
// creates and inserts one tabulator sign or whitespace of the amount of the tab width
gchar *text = utils_get_whitespace(app->pref_editor_tab_width, TRUE);
sci_add_text(sci, text);
g_free(text);
}
void sci_cb_select_word(ScintillaObject *sci)
{
gint pos;

View File

@ -88,4 +88,6 @@ void sci_cb_insert_multiline_comment(gint idx);
void sci_cb_select_word(ScintillaObject *sci);
void sci_cb_insert_alternative_whitespace(ScintillaObject *sci);
#endif

View File

@ -1449,14 +1449,18 @@ gchar *utils_get_utf8_from_locale(const gchar *locale_text)
/* Returns a string containing whitespace of the amount a according to the
* setting app->pref_editor_use_tabs filled with simple space characters or with the right amount
* of tabulator characters (a is filled with tabulators *and* spaces if a isn't a multiple of
* app->pref_editor_tab_width) */
gchar *utils_get_whitespace(gint a)
* app->pref_editor_tab_width).
* If alternative is set to TRUE, it returns the opposite of app->pref_editor_use_tabs. */
gchar *utils_get_whitespace(gint a, gboolean alternative)
{
gchar *str;
gboolean use_tabs;
g_return_val_if_fail(a > 0, NULL);
if (app->pref_editor_use_tabs)
use_tabs = (alternative) ? ! app->pref_editor_use_tabs : app->pref_editor_use_tabs;
if (use_tabs)
{ // first fill text with tabluators and fill the rest with spaces
gint tabs = a / app->pref_editor_tab_width;
gint spaces = a % app->pref_editor_tab_width;

View File

@ -148,8 +148,9 @@ gchar *utils_get_utf8_from_locale(const gchar *locale_text);
/* Returns a string containing whitespace of the amount a according to the
* setting app->pref_editor_use_tabs filled with simple space characters or with the right amount
* of tabulator characters (a is filled with tabulators *and* spaces if a isn't a multiple of
* app->pref_editor_tab_width) */
gchar *utils_get_whitespace(gint amount);
* app->pref_editor_tab_width).
* If alternative is set to TRUE, it returns the opposite of app->pref_editor_use_tabs. */
gchar *utils_get_whitespace(gint amount, gboolean alternative);
/* frees all passed pointers if they are non-NULL, the first argument is nothing special,
* it will also be freed, the list should be ended with NULL */