Kaydet (Commit) 00afcbcc authored tarafından Enrico Tröger's avatar Enrico Tröger

Add special key wordchars to autocomplete.conf to let the user redefine used wordchars.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1960 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 89b96821
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
* src/plugindata.h, src/plugins.c: * src/plugindata.h, src/plugins.c:
Add encoding related functions to the plugin API. Add encoding related functions to the plugin API.
* data/autocomplete.conf, doc/geany.txt, doc/geany.html, src/editor.c:
Add special key wordchars to autocomplete.conf to let the user
redefine used wordchars.
2007-10-18 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> 2007-10-18 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
......
...@@ -24,11 +24,14 @@ try=try%block_cursor%catch ()%block% ...@@ -24,11 +24,14 @@ try=try%block_cursor%catch ()%block%
# special keys to be used in other completions, cannot be used "standalone" # special keys to be used in other completions, cannot be used "standalone"
# can be used by %key%, e.g. %brace_open% # can be used by %key%, e.g. %brace_open%
# nesting of special keys is not supported (e.g. brace_open=\n{\n%brace_close% won't work) # nesting of special keys is not supported (e.g. brace_open=\n{\n%brace_close% won't work)
# key "wordchars" is very special, it defines the word delimiting characters when looking for
# a word to auto complete, leave commented to use the default wordchars
[Special] [Special]
brace_open=\n{\n\t brace_open=\n{\n\t
brace_close=}\n brace_close=}\n
block=\n{\n\t\n}\n block=\n{\n\t\n}\n
block_cursor=\n{\n\t%cursor%\n}\n block_cursor=\n{\n\t%cursor%\n}\n
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
[C++] [C++]
for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close% for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close%
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" />
<title>Geany</title> <title>Geany</title>
<meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" /> <meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" />
<meta name="date" content="2007-10-02" /> <meta name="date" content="2007-10-02" />
...@@ -135,7 +135,7 @@ dt { ...@@ -135,7 +135,7 @@ dt {
<tr><th class="docinfo-name">Date:</th> <tr><th class="docinfo-name">Date:</th>
<td>2007-10-02</td></tr> <td>2007-10-02</td></tr>
<tr><th class="docinfo-name">Version:</th> <tr><th class="docinfo-name">Version:</th>
<td>0.12</td></tr> <td>0.13</td></tr>
</tbody> </tbody>
</table> </table>
<p>Copyright © 2005-2007</p> <p>Copyright © 2005-2007</p>
...@@ -882,6 +882,12 @@ myname=Enrico Tröger ...@@ -882,6 +882,12 @@ myname=Enrico Tröger
<p>Everytime you write <tt class="docutils literal"><span class="pre">myname</span></tt> &lt;TAB&gt; in Geany, it will replace &quot;myname&quot; <p>Everytime you write <tt class="docutils literal"><span class="pre">myname</span></tt> &lt;TAB&gt; in Geany, it will replace &quot;myname&quot;
with &quot;Enrico Tröger&quot;. The key to start auto completion can be changed with &quot;Enrico Tröger&quot;. The key to start auto completion can be changed
in the preferences dialog, by default it is TAB.</p> in the preferences dialog, by default it is TAB.</p>
<p>You may change the behaviour Geany recognizes the word to auto complete,
i.e. where define the start and end of a word. The section &quot;Special&quot; may
contain a key &quot;wordchars&quot; which lists all characters a string may contain
to be recognized as a word for auto completion. Leave it commented to use
default characters or define it to add or remove characters to fit your
needs.</p>
</div> </div>
<div class="section"> <div class="section">
<h3><a class="toc-backref" href="#id31" id="inserting-unicode-characters" name="inserting-unicode-characters">Inserting unicode characters</a></h3> <h3><a class="toc-backref" href="#id31" id="inserting-unicode-characters" name="inserting-unicode-characters">Inserting unicode characters</a></h3>
...@@ -2340,7 +2346,7 @@ gpl</td> ...@@ -2340,7 +2346,7 @@ gpl</td>
</tr> </tr>
<tr><td>geanyversion</td> <tr><td>geanyversion</td>
<td>The actual Geany version, e.g. <td>The actual Geany version, e.g.
&quot;Geany 0.12&quot;.</td> &quot;Geany 0.13&quot;.</td>
<td>filetypes, file header, function <td>filetypes, file header, function
description, ChangeLog entry, bsd, description, ChangeLog entry, bsd,
gpl</td> gpl</td>
...@@ -2391,7 +2397,7 @@ editing the file, to build the HTML document to see how your changes ...@@ -2391,7 +2397,7 @@ editing the file, to build the HTML document to see how your changes
look, run &quot;<tt class="docutils literal"><span class="pre">make</span> <span class="pre">doc</span></tt>&quot; in the subdirectory <tt class="docutils literal"><span class="pre">doc</span></tt> of Geany's source look, run &quot;<tt class="docutils literal"><span class="pre">make</span> <span class="pre">doc</span></tt>&quot; in the subdirectory <tt class="docutils literal"><span class="pre">doc</span></tt> of Geany's source
directory. This regenerates the <tt class="docutils literal"><span class="pre">geany.html</span></tt> file. To generate a PDF directory. This regenerates the <tt class="docutils literal"><span class="pre">geany.html</span></tt> file. To generate a PDF
file, use the command &quot;<tt class="docutils literal"><span class="pre">make</span> <span class="pre">pdf</span></tt>&quot; which should generate a file called file, use the command &quot;<tt class="docutils literal"><span class="pre">make</span> <span class="pre">pdf</span></tt>&quot; which should generate a file called
geany-0.12.pdf.</p> geany-0.13.pdf.</p>
<p>After you are happy with your changes, create a patch:</p> <p>After you are happy with your changes, create a patch:</p>
<pre class="literal-block"> <pre class="literal-block">
% svn diff geany.txt &gt; foo.patch % svn diff geany.txt &gt; foo.patch
...@@ -3086,7 +3092,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p> ...@@ -3086,7 +3092,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
<div class="footer"> <div class="footer">
<hr class="footer" /> <hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>. <a class="reference" href="geany.txt">View document source</a>.
Generated on: 2007-10-02 16:10 UTC. Generated on: 2007-10-18 19:44 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. 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> </div>
......
.. |(version)| replace:: 0.12 .. |(version)| replace:: 0.13
======= =======
Geany Geany
...@@ -639,6 +639,13 @@ Everytime you write ``myname`` <TAB> in Geany, it will replace "myname" ...@@ -639,6 +639,13 @@ Everytime you write ``myname`` <TAB> in Geany, it will replace "myname"
with "Enrico Tröger". The key to start auto completion can be changed with "Enrico Tröger". The key to start auto completion can be changed
in the preferences dialog, by default it is TAB. in the preferences dialog, by default it is TAB.
You may change the behaviour Geany recognizes the word to auto complete,
i.e. where define the start and end of a word. The section "Special" may
contain a key "wordchars" which lists all characters a string may contain
to be recognized as a word for auto completion. Leave it commented to use
default characters or define it to add or remove characters to fit your
needs.
Inserting unicode characters Inserting unicode characters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......
...@@ -1231,6 +1231,7 @@ gboolean editor_auto_complete(gint idx, gint pos) ...@@ -1231,6 +1231,7 @@ gboolean editor_auto_complete(gint idx, gint pos)
{ {
gboolean result = FALSE; gboolean result = FALSE;
gint lexer, style; gint lexer, style;
gchar *wc;
ScintillaObject *sci; ScintillaObject *sci;
if (! DOC_IDX_VALID(idx)) if (! DOC_IDX_VALID(idx))
...@@ -1244,7 +1245,8 @@ gboolean editor_auto_complete(gint idx, gint pos) ...@@ -1244,7 +1245,8 @@ gboolean editor_auto_complete(gint idx, gint pos)
lexer = SSM(sci, SCI_GETLEXER, 0, 0); lexer = SSM(sci, SCI_GETLEXER, 0, 0);
style = SSM(sci, SCI_GETSTYLEAT, pos - 2, 0); style = SSM(sci, SCI_GETSTYLEAT, pos - 2, 0);
editor_find_current_word(sci, pos, current_word, sizeof current_word, NULL); wc = ac_find_completion_by_name("Special", "wordchars");
editor_find_current_word(sci, pos, current_word, sizeof current_word, wc);
// prevent completion of "for " // prevent completion of "for "
if (! isspace(sci_get_char_at(sci, pos - 1))) // pos points to the line end char so use pos -1 if (! isspace(sci_get_char_at(sci, pos - 1))) // pos points to the line end char so use pos -1
...@@ -1254,6 +1256,7 @@ gboolean editor_auto_complete(gint idx, gint pos) ...@@ -1254,6 +1256,7 @@ gboolean editor_auto_complete(gint idx, gint pos)
sci_end_undo_action(sci); sci_end_undo_action(sci);
} }
g_free(wc);
return result; return result;
} }
......
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