[latexila] Structure: don't take into account stuff in verbatim env
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Structure: don't take into account stuff in verbatim env
- Date: Fri, 10 Jun 2011 19:43:56 +0000 (UTC)
commit 3aedc3c2528b3e563df60afe07f0ed30855c3355
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Tue Jun 7 22:56:36 2011 +0200
Structure: don't take into account stuff in verbatim env
TODO | 2 --
src/document_structure.vala | 15 ++++++++++++++-
2 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/TODO b/TODO
index f7c6496..68aabac 100644
--- a/TODO
+++ b/TODO
@@ -7,8 +7,6 @@ LaTeXila 2.2
============
- Structure (list of chapters, sections, etc. to easily navigate in a document):
- - Doesn't take into account stuff in verbatim environment.
-
- Different style (e.g. italic) for commented items.
- Add a show/hide button for sections.
diff --git a/src/document_structure.vala b/src/document_structure.vala
index 593e0a4..10d7aab 100644
--- a/src/document_structure.vala
+++ b/src/document_structure.vala
@@ -34,6 +34,7 @@ public class DocumentStructure : GLib.Object
private bool _in_figure_env = false;
private bool _in_table_env = false;
+ private bool _in_verbatim_env = false;
private static const int MAX_NB_LINES_TO_PARSE = 2000;
private int _start_parsing_line = 0;
@@ -150,7 +151,7 @@ public class DocumentStructure : GLib.Object
search_markup (line, index);
// search comments (begin with '%')
- else
+ else if (! _in_verbatim_env)
search_comment (line, index);
}
@@ -255,6 +256,9 @@ public class DocumentStructure : GLib.Object
}
/* simple markup */
+ if (_in_verbatim_env)
+ return;
+
StructType? type = get_markup_type (name);
if (type == null)
return;
@@ -272,6 +276,15 @@ public class DocumentStructure : GLib.Object
if (contents == null)
return;
+ if (contents == "verbatim" || contents == "verbatim*")
+ {
+ _in_verbatim_env = is_begin_env;
+ return;
+ }
+
+ if (_in_verbatim_env)
+ return;
+
switch (contents)
{
case "figure":
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]