Kaydet (Commit) c61a189c authored tarafından Nick Treleaven's avatar Nick Treleaven

If the current word's tag is on the current line, make Go to Tag

Definition look for a tag declaration instead, as this is more
useful. Likewise make Go to Tag Declaration search for a tag
definition in this case also.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5428 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 47372d93
......@@ -3,6 +3,11 @@
* src/interface.c, src/keybindings.c, src/callbacks.c,
src/callbacks.h, geany.glade:
Add 'Mark All' Search menu command.
* src/symbols.c, doc/geany.txt, doc/geany.html:
If the current word's tag is on the current line, make Go to Tag
Definition look for a tag declaration instead, as this is more
useful. Likewise make Go to Tag Declaration search for a tag
definition in this case also.
2010-11-22 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-11-17" />
<meta name="date" content="2010-11-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>2010-11-17</td></tr>
<td>2010-11-22</td></tr>
<tr><th class="docinfo-name">Version:</th>
<td>0.20</td></tr>
</tbody>
......@@ -1732,6 +1732,13 @@ will switch to that file and go to the corresponding line number. The
current word is either the word nearest the edit cursor,
or the word underneath the popup menu click position when the popup
menu is used.</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">If the current word's tag is on the current line, Geany will try
to look for a tag declaration instead, as this is more useful.
Likewise 'Go to tag declaration' will search for a tag definition
in this case also.</p>
</div>
</div>
<div class="section">
<h3><a class="toc-backref" href="#id73" id="go-to-tag-declaration" name="go-to-tag-declaration">Go to tag declaration</a></h3>
......@@ -6359,7 +6366,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-11-22 12:42 UTC.
Generated on: 2010-11-23 13:12 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>
......
......@@ -1357,6 +1357,12 @@ current word is either the word nearest the edit cursor,
or the word underneath the popup menu click position when the popup
menu is used.
.. note::
If the current word's tag is on the current line, Geany will try
to look for a tag declaration instead, as this is more useful.
Likewise 'Go to tag declaration' will search for a tag definition
in this case also.
Go to tag declaration
^^^^^^^^^^^^^^^^^^^^^
......
......@@ -1542,7 +1542,7 @@ static void load_user_tags(filetype_id ft_id)
}
gboolean symbols_goto_tag(const gchar *name, gboolean definition)
static gboolean goto_tag(const gchar *name, gboolean definition)
{
const gint forward_types = tm_tag_prototype_t | tm_tag_externvar_t;
gint type;
......@@ -1565,18 +1565,38 @@ gboolean symbols_goto_tag(const gchar *name, gboolean definition)
GeanyDocument *new_doc = document_find_by_real_path(
tmtag->atts.entry.file->work_object.file_name);
/* not found in opened document, should open */
if (new_doc == NULL)
if (new_doc)
{
/* If we are already on the tag line, swap definition/declaration */
if (new_doc == old_doc &&
tmtag->atts.entry.line == (guint)sci_get_current_line(old_doc->editor->sci) + 1)
{
if (goto_tag(name, !definition))
return TRUE;
}
}
else
{
/* not found in opened document, should open */
new_doc = document_open_file(tmtag->atts.entry.file->work_object.file_name, FALSE, NULL, NULL);
}
if (navqueue_goto_line(old_doc, new_doc, tmtag->atts.entry.line))
return TRUE;
}
return FALSE;
}
gboolean symbols_goto_tag(const gchar *name, gboolean definition)
{
if (goto_tag(name, definition))
return TRUE;
/* if we are here, there was no match and we are beeping ;-) */
utils_beep();
if (type == forward_types)
if (!definition)
ui_set_statusbar(FALSE, _("Forward declaration \"%s\" not found."), name);
else
ui_set_statusbar(FALSE, _("Definition of \"%s\" not found."), name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment