Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sun, 02 Jun 2013 20:42:47 UTC
Commit: fe0280037d9b964e56c405b1efedbcea5cec762e
https://github.com/geany/geany/commit/fe0280037d9b964e56c405b1efedbcea5cec7…
Log Message:
-----------
Indentation width detection: try not to get fooled by comments
C-style multiline comments, used among others in C, C++ and Java, are
often continued on next lines with an additional space followed by an
asterisk:
1. /* first comment line
2. * continuation line (asterisk is aligned with previous line)
3. * last line */
This fools the indentation with detection because lines 2 and 3 from
the above example have an extra space in what is considered being the
line indentation. In this example, the algorithm would detect an
indentation width of 5 rather than 4, because here most lines have an
indent of 5 -- although they actually have an indent of 4 plus a space
for alignment. This is not a problem in most situations because there
generally are fewer comment continuation lines than actual code lines
which have a indent multiple of the actual indent width, but with some
code with a lot of comments (e.g. short functions with verbose
documentation comments) this might start to fool the algorithm and
give wrong, annoying, results.
So, try to detect these continuation lines and avoid taking them into
account.
Modified Paths:
--------------
src/document.c
Modified: src/document.c
10 files changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -976,6 +976,16 @@ static gboolean detect_indent_width(GeanyEditor *editor, GeanyIndentType type, g
line_count = sci_get_line_count(sci);
for (line = 0; line < line_count; line++)
{
+ gint pos = sci_get_line_indent_position(sci, line);
+
+ /* We probably don't have style info yet, because we're generally called just after
+ * the document got created, so we can't use highlighting_is_code_style().
+ * That's not good, but the assumption below that concerning lines start with an
+ * asterisk (common continuation character for C/C++/Java/...) should do the trick
+ * without removing too much legitimate lines. */
+ if (sci_get_char_at(sci, pos) == '*')
+ continue;
+
width = sci_get_line_indentation(sci, line);
/* most code will have indent total <= 24, otherwise it's more likely to be
* alignment than indentation */
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sat, 01 Jun 2013 18:07:12 UTC
Commit: 8afff838c1127067e621ec49652d715427d3e141
https://github.com/geany/geany/commit/8afff838c1127067e621ec49652d715427d3e…
Log Message:
-----------
Improve scrolling to display a plugin's keybindings
When scrolling the keybinding list to display a particular row, which
is used to display a particular plugin's keybindings, consistently
scroll so the row is on the top left. This makes it easier to see the
row in question since it's always at the same location, and it shows
more child keybindings.
Modified Paths:
--------------
src/prefs.c
Modified: src/prefs.c
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -350,7 +350,7 @@ void prefs_kb_search_name(const gchar *search)
if (g_strcmp0(name, search) == 0)
{
GtkTreePath *path = gtk_tree_model_get_path(model, &iter);
- gtk_tree_view_scroll_to_cell(tree, path, NULL, FALSE, .0f, .0f);
+ gtk_tree_view_scroll_to_cell(tree, path, NULL, TRUE, .0f, .0f);
gtk_tree_path_free(path);
g_free(name);
break;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).