Wrap calltip and prevent it obscuring the current line
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@666 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
51f4486876
commit
c6fa1febba
@ -1,3 +1,9 @@
|
||||
2006-08-03 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||
|
||||
* src/utils.c, src/utils.h, src/sci_cb.c:
|
||||
Wrap calltip and prevent it obscuring the current line.
|
||||
|
||||
|
||||
2006-08-02 Enrico Tröger <enrico.troeger@uvena.de>
|
||||
|
||||
* src/callbacks.c:
|
||||
|
||||
@ -351,6 +351,7 @@ void sci_cb_close_block(ScintillaObject *sci, gint pos)
|
||||
|
||||
gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos, gint idx)
|
||||
{
|
||||
gint orig_pos = pos; //the position for the calltip
|
||||
gint lexer;
|
||||
gint style;
|
||||
gchar word[GEANY_MAX_WORD_LENGTH];
|
||||
@ -368,6 +369,7 @@ gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos, gint idx)
|
||||
gchar c;
|
||||
// position of '(' is unknown, so go backwards to find it
|
||||
pos = SSM(sci, SCI_GETCURRENTPOS, 0, 0);
|
||||
orig_pos = pos;
|
||||
// I'm not sure if utils_is_opening_brace() is a good idea, but it is the simplest way,
|
||||
// but we need something more intelligent than only check for '(' because e.g. LaTeX
|
||||
// uses {, [ or (
|
||||
@ -397,7 +399,8 @@ gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos, gint idx)
|
||||
else
|
||||
calltip = g_strconcat(tag->name, " ", tag->atts.entry.arglist, NULL);
|
||||
|
||||
SSM(sci, SCI_CALLTIPSHOW, pos, (sptr_t) calltip);
|
||||
utils_wrap_string(calltip, -1);
|
||||
SSM(sci, SCI_CALLTIPSHOW, orig_pos, (sptr_t) calltip);
|
||||
g_free(calltip);
|
||||
}
|
||||
|
||||
|
||||
22
src/utils.c
22
src/utils.c
@ -2532,3 +2532,25 @@ void utils_document_show_hide(gint idx)
|
||||
app->ignore_callback = FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Wraps a string in place, replacing a space with a newline character.
|
||||
* wrapstart is the minimum position to start wrapping or -1 for default */
|
||||
gboolean utils_wrap_string(gchar *string, gint wrapstart)
|
||||
{
|
||||
gchar *pos, *linestart;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
if (wrapstart < 0) wrapstart = 80;
|
||||
|
||||
for (pos = linestart = string; *pos != '\0'; pos++)
|
||||
{
|
||||
if (pos - linestart >= wrapstart && *pos == ' ')
|
||||
{
|
||||
*pos = '\n';
|
||||
linestart = pos;
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -227,4 +227,8 @@ gboolean utils_is_unicode_charset(const gchar *string);
|
||||
|
||||
void utils_document_show_hide(gint idx);
|
||||
|
||||
/* Wraps a string in place, replacing a space with a newline character.
|
||||
* wrapstart is the minimum position to start wrapping or -1 for default */
|
||||
gboolean utils_wrap_string(gchar *string, gint wrapstart);
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user