Skip to content

Commit

Permalink
Backport from trunk:
Browse files Browse the repository at this point in the history
Fix LaTeX environment auto completion with CR/LF line endings.
Add some sanity checks.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/geany-0.18.1@4621 ea778897-0a13-0410-b9d1-a72fbfd435f5
  • Loading branch information
eht16 committed Jan 31, 2010
1 parent 0cc56a6 commit ad63449
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Expand Up @@ -10,6 +10,13 @@
Add gcc commands to build a plugin to the HowTo.


2009-12-20 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

* src/editor.c:
Fix LaTeX environment auto completion with CR/LF line endings.
Add some sanity checks.


2009-12-20 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>

* src/editor.c:
Expand Down
8 changes: 4 additions & 4 deletions src/editor.c
Expand Up @@ -1944,7 +1944,7 @@ static void editor_auto_latex(GeanyEditor *editor, gint pos)

sci = editor->sci;

if (sci_get_char_at(sci, pos - 2) == '}')
if (sci_get_char_at(sci, pos - 1 - editor_get_eol_char_len(editor)) == '}')
{
gchar *eol, *buf, *construct;
gchar env[50];
Expand All @@ -1957,8 +1957,8 @@ static void editor_auto_latex(GeanyEditor *editor, gint pos)

/* get to the first non-blank char (some kind of ltrim()) */
start = 0;
/*while (isspace(buf[i++])) start++;*/
while (isspace(buf[start])) start++;
while (isspace(buf[start]) && buf[start] != '\0')
start++;

/* check for begin */
if (strncmp(buf + start, "\\begin", 6) == 0)
Expand Down Expand Up @@ -2006,7 +2006,7 @@ static void editor_auto_latex(GeanyEditor *editor, gint pos)
tmp = sci_get_line(sci, line + i);
/* Again get to the first non-blank char */
start = 0;
while (isspace(buf[start]))
while (isspace(buf[start]) && buf[start] != '\0')
start++;
end_construct = g_strdup_printf("\\end%s{%s}", full_cmd, env);
if (strstr(tmp, end_construct) != NULL)
Expand Down

0 comments on commit ad63449

Please sign in to comment.