[latexila] Use string.get_prev_char() for Utils.char_is_escaped()
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Use string.get_prev_char() for Utils.char_is_escaped()
- Date: Wed, 18 Jul 2012 18:16:44 +0000 (UTC)
commit b8f161dac7906b6f0e775852d98874047c11d683
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Wed Jul 18 20:01:12 2012 +0200
Use string.get_prev_char() for Utils.char_is_escaped()
This requires Vala from git master.
CMakeLists.txt | 2 +-
src/utils.vala | 14 +++-----------
2 files changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 338ea07..830bad8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,7 @@ find_package (Itstool REQUIRED)
# Vala
if (BUILD_VALA)
set (_vala_main_version "0.18")
- set (_vala_min_version "0.17.1")
+ set (_vala_min_version "0.17.3.1")
if (VALAC)
message (STATUS "Use custom valac: ${VALAC}")
diff --git a/src/utils.vala b/src/utils.vala
index 7edecee..56337dd 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -38,23 +38,15 @@ namespace Utils
{
return_val_if_fail (char_index < text.length, false);
- int index = (int) char_index;
- if (! string_get_prev_char (text, ref index, null))
- return false;
-
bool escaped = false;
- while (true)
+ int index = (int) char_index;
+ unichar cur_char;
+ while (text.get_prev_char (ref index, out cur_char))
{
- unichar cur_char;
- bool first_char = ! string_get_prev_char (text, ref index, out cur_char);
-
if (cur_char != '\\')
break;
escaped = ! escaped;
-
- if (first_char)
- break;
}
return escaped;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]