--- rxvt-unicode/src/rxvt.h 2021/06/17 01:44:29 1.559 +++ rxvt-unicode/src/rxvt.h 2021/07/03 04:04:13 1.566 @@ -125,7 +125,15 @@ /****************************************************************************/ // exception thrown on fatal (per-instance) errors -class rxvt_failure_exception { }; +class rxvt_failure_exception : public std::exception +{ +public: + const char * + what () const noexcept override + { + return ""; + } +}; // exception thrown when the command parser runs out of input data class out_of_input { }; @@ -791,9 +799,9 @@ // not fitting in the BMP. struct compose_char { - // c1 can be any chaarcter != NOCHAR, including another compose character + // c1 can be any character != NOCHAR, including another compose character // c2 must always be a zero-width character or NOCHAR, in case - // this just extends beyondthe BMP. + // this just extends beyond the BMP. unicode_t c1, c2; compose_char (unicode_t c1, unicode_t c2) @@ -801,10 +809,10 @@ { } }; -class rxvt_composite_vec +struct rxvt_composite_vec { vector v; -public: + text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); template int expand (unicode_t c, T *r); int expand (unicode_t c) { return expand (c, (text_t *)0); } @@ -819,6 +827,65 @@ extern class rxvt_composite_vec rxvt_composite; #endif +#if 0 +// expand the sequence into a static array +// works even without ENABLE_COMBINING +template +struct rxvt_compose_expand_static +{ +#if ENABLE_COMBINING + enum { max_size = max_size_ }; + + T chrs[max_size]; + + // expand sequence and return start ptr + // guarantees at least one output + // get the length with length () on that ptr + T *operator ()(unicode_t c) + { + T *cur = chrs + max_size; + + while (ecb_expect_false (IS_COMPOSE (c))) + if (ecb_expect_true (c - COMPOSE_LO < rxvt_composite.v.size ())) + { + compose_char *cc = &rxvt_composite.v [c - COMPOSE_LO]; + + if (cc->c2 != NOCHAR) + { + cur -= cur > chrs; *cur = cc->c2; + } + + c = cc->c1; + } + else + c = NOCHAR; + + cur -= cur > chrs; *cur = c; + + return cur; + } + + int length (T *first) + { + return chrs + max_size - first; + } +#else + T chr; + + T *operator ()(text_t c); + { + chr = c; + return &chr; + } + + int length (T *first) + { + return 1; + } +#endif +}; +#endif + /****************************************************************************/ #ifdef KEYSYM_RESOURCE @@ -1035,6 +1102,8 @@ bypass_keystate:1, #if ENABLE_FRILLS urgency_hint:1, + rewrap_always:1, + rewrap_never:1, #endif #if CURSOR_BLINK hidden_cursor:1,