about summary refs log tree commit diff
path: root/Src/Zle/zle.h
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-02-18 22:08:45 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-02-18 22:08:45 +0000
commit212ca9edf9c2be0499cdce39326abba57b088bcd (patch)
treeb14bcc7e91fb33213b349914c477d9c22cd8a25d /Src/Zle/zle.h
parent6be3fe2fca7d904ce4c83303a1b23e36ed45a084 (diff)
downloadzsh-212ca9edf9c2be0499cdce39326abba57b088bcd.tar.gz
zsh-212ca9edf9c2be0499cdce39326abba57b088bcd.tar.xz
zsh-212ca9edf9c2be0499cdce39326abba57b088bcd.zip
28772: Update regions in region highlight dynamically
Diffstat (limited to 'Src/Zle/zle.h')
-rw-r--r--Src/Zle/zle.h56
1 files changed, 55 insertions, 1 deletions
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index 32f3e59f6..bedf28f17 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -385,6 +385,47 @@ enum suffixflags {
     SUFFLAGS_SPACE = 0x0001	/* Add a space when removing suffix */
 };
 
+
+/* Flags for the region_highlight structure */
+enum {
+    /* Offsets include predisplay */
+    ZRH_PREDISPLAY = 1
+};
+
+/*
+ * Attributes used for highlighting regions.
+ * and mark.
+ */
+struct region_highlight {
+    /* Attributes turned on in the region */
+    int atr;
+    /* Start of the region */
+    int start;
+    /* Start of the region in metafied ZLE line */
+    int start_meta;
+    /*
+     * End of the region:  position of the first character not highlighted
+     * (the same system as for point and mark).
+     */
+    int end;
+    /* End of the region in metafied ZLE line */
+    int end_meta;
+    /*
+     * Any of the flags defined above.
+     */
+    int flags;
+};
+
+/*
+ * Count of special uses of region highlighting, which account
+ * for the first few elements of region_highlights.
+ * 0: region between point and mark
+ * 1: isearch region
+ * 2: suffix
+ */
+#define N_SPECIAL_HIGHLIGHTS	(3)
+
+
 #ifdef MULTIBYTE_SUPPORT
 /*
  * We use a wint_t here, since we need an invalid character as a
@@ -420,15 +461,28 @@ typedef REFRESH_ELEMENT *REFRESH_STRING;
 
 
 #if defined(MULTIBYTE_SUPPORT) && defined(__STDC_ISO_10646__)
+/*
+ * With ISO 10646 there is a private range defined within
+ * the encoding.  We use this for storing single-byte
+ * characters in sections of strings that wouldn't convert to wide
+ * characters.  This allows to preserve the string when transformed
+ * back to multibyte strings.
+ */
+
+/* The start of the private range we use, for 256 characters */
 #define ZSH_INVALID_WCHAR_BASE	(0xe000U)
+/* Detect a wide character within our range */
 #define ZSH_INVALID_WCHAR_TEST(x)			\
     ((unsigned)(x) >= ZSH_INVALID_WCHAR_BASE &&		\
      (unsigned)(x) <= (ZSH_INVALID_WCHAR_BASE + 255u))
+/* Turn a wide character in that range back to single byte */
 #define ZSH_INVALID_WCHAR_TO_CHAR(x)			\
     ((char)((unsigned)(x) - ZSH_INVALID_WCHAR_BASE))
+/* Turn a wide character in that range to an integer */
 #define ZSH_INVALID_WCHAR_TO_INT(x)			\
     ((int)((unsigned)(x) - ZSH_INVALID_WCHAR_BASE))
-#define ZSH_CHAR_TO_INVALID_WCHAR(x)		\
+/* Turn a single byte character into a private wide character */
+#define ZSH_CHAR_TO_INVALID_WCHAR(x)			\
     ((wchar_t)(STOUC(x) + ZSH_INVALID_WCHAR_BASE))
 #endif