From 00afcbcc8601f388fa39f15d605997219a3d7a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Thu, 18 Oct 2007 19:55:21 +0000 Subject: [PATCH] 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 --- ChangeLog | 3 +++ data/autocomplete.conf | 3 +++ doc/geany.html | 16 +++++++++++----- doc/geany.txt | 9 ++++++++- src/editor.c | 5 ++++- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 219a3813a..c50bf067a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * src/plugindata.h, src/plugins.c: 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 diff --git a/data/autocomplete.conf b/data/autocomplete.conf index a2efecbe4..6b778b2a7 100644 --- a/data/autocomplete.conf +++ b/data/autocomplete.conf @@ -24,11 +24,14 @@ try=try%block_cursor%catch ()%block% # special keys to be used in other completions, cannot be used "standalone" # 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) +# 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] brace_open=\n{\n\t brace_close=}\n block=\n{\n\t\n}\n block_cursor=\n{\n\t%cursor%\n}\n +#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 [C++] for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close% diff --git a/doc/geany.html b/doc/geany.html index 8212454de..f5268a2b3 100644 --- a/doc/geany.html +++ b/doc/geany.html @@ -3,7 +3,7 @@ - + Geany @@ -135,7 +135,7 @@ dt { Date: 2007-10-02 Version: -0.12 +0.13

Copyright © 2005-2007

@@ -882,6 +882,12 @@ myname=Enrico Tröger

Everytime you write myname <TAB> in Geany, it will replace "myname" with "Enrico Tröger". The key to start auto completion can be changed 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

@@ -2340,7 +2346,7 @@ gpl geanyversion The actual Geany version, e.g. -"Geany 0.12". +"Geany 0.13". filetypes, file header, function description, ChangeLog entry, bsd, gpl @@ -2391,7 +2397,7 @@ editing the file, to build the HTML document to see how your changes look, run "make doc" in the subdirectory doc of Geany's source directory. This regenerates the geany.html file. To generate a PDF file, use the command "make pdf" which should generate a file called -geany-0.12.pdf.

+geany-0.13.pdf.

After you are happy with your changes, create a patch:

 % svn diff geany.txt > foo.patch
@@ -3086,7 +3092,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.

diff --git a/doc/geany.txt b/doc/geany.txt index 527801171..653c46576 100644 --- a/doc/geany.txt +++ b/doc/geany.txt @@ -1,4 +1,4 @@ -.. |(version)| replace:: 0.12 +.. |(version)| replace:: 0.13 ======= Geany @@ -639,6 +639,13 @@ Everytime you write ``myname`` in Geany, it will replace "myname" with "Enrico Tröger". The key to start auto completion can be changed 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/editor.c b/src/editor.c index 3a55c74ab..aaa80107c 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1231,6 +1231,7 @@ gboolean editor_auto_complete(gint idx, gint pos) { gboolean result = FALSE; gint lexer, style; + gchar *wc; ScintillaObject *sci; if (! DOC_IDX_VALID(idx)) @@ -1244,7 +1245,8 @@ gboolean editor_auto_complete(gint idx, gint pos) lexer = SSM(sci, SCI_GETLEXER, 0, 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 " 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) sci_end_undo_action(sci); } + g_free(wc); return result; }