[wiki] [sites] [st][iso14755] Update patch for 0.8.2 release || Alvar Penning

From: <git_AT_suckless.org>
Date: Wed, 22 Apr 2020 15:55:49 +0200

commit bcd19705d37f3540796713303219a0d30ad64e9a
Author: Alvar Penning <post_AT_0x21.biz>
Date: Wed Apr 22 15:53:43 2020 +0200

    [st][iso14755] Update patch for 0.8.2 release
    
    The previous version of the patch was not compatible with the latest
    release, 0.8.2. This small modification changes this.

diff --git a/st.suckless.org/patches/iso14755/index.md b/st.suckless.org/patches/iso14755/index.md
index 58982fab..b3722855 100644
--- a/st.suckless.org/patches/iso14755/index.md
+++ b/st.suckless.org/patches/iso14755/index.md
_AT_@ -8,6 +8,7 @@ a unicode codepoint that will be converted to a glyph and then pushed to st.
 
 Download
 --------
+* [st-iso14755-0.8.2.diff](st-iso14755-0.8.2.diff)
 * [st-iso14755-20180911-67d0cb6.diff](st-iso14755-20180911-67d0cb6.diff)
 
 Authors
diff --git a/st.suckless.org/patches/iso14755/st-iso14755-0.8.2.diff b/st.suckless.org/patches/iso14755/st-iso14755-0.8.2.diff
new file mode 100644
index 00000000..868fcaf4
--- /dev/null
+++ b/st.suckless.org/patches/iso14755/st-iso14755-0.8.2.diff
_AT_@ -0,0 +1,88 @@
+diff --git a/config.def.h b/config.def.h
+index 0e01717..c6d7f58 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -178,6 +178,7 @@ static Shortcut shortcuts[] = {
+ { TERMMOD, XK_Y, selpaste, {.i = 0} },
+ { ShiftMask, XK_Insert, selpaste, {.i = 0} },
+ { TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
++ { TERMMOD, XK_I, iso14755, {.i = 0} },
+ };
+
+ /*
+diff --git a/st.1 b/st.1
+index e8d6059..81bceff 100644
+--- a/st.1
++++ b/st.1
+_AT_@ -159,6 +159,10 @@ Copy the selected text to the clipboard selection.
+ .TP
+ .B Ctrl-Shift-v
+ Paste from the clipboard selection.
++.TP
++.B Ctrl-Shift-i
++Launch dmenu to enter a unicode codepoint and send the corresponding glyph
++to st.
+ .SH CUSTOMIZATION
+ .B st
+ can be customized by creating a custom config.h and (re)compiling the source
+diff --git a/st.c b/st.c
+index b8e6077..c089df3 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -38,11 +38,15 @@
+
+ /* macros */
+ #define IS_SET(flag) ((term.mode & (flag)) != 0)
++#define NUMMAXLEN(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
+ #define ISCONTROLC0(c) (BETWEEN(c, 0, 0x1f) || (c) == '\177')
+ #define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
+ #define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
+ #define ISDELIM(u) (utf8strchr(worddelimiters, u) != NULL)
+
++/* constants */
++#define ISO14755CMD "dmenu -w \"$WINDOWID\" -p codepoint: </dev/null"
++
+ enum term_mode {
+ MODE_WRAP = 1 << 0,
+ MODE_INSERT = 1 << 1,
+_AT_@ -1980,6 +1984,28 @@ tprinter(char *s, size_t len)
+ }
+ }
+
++void
++iso14755(const Arg *arg)
++{
++ FILE *p;
++ char *us, *e, codepoint[9], uc[UTF_SIZ];
++ unsigned long utf32;
++
++ if (!(p = popen(ISO14755CMD, "r")))
++ return;
++
++ us = fgets(codepoint, sizeof(codepoint), p);
++ pclose(p);
++
++ if (!us || *us == '++ return;
++ if ((utf32 = strtoul(us, &e, 16)) == ULONG_MAX ||
++ (*e != '
' && *e != '++ return;
++
++ ttywrite(uc, utf8encode(utf32, uc), 1);
++}
++
+ void
+ toggleprinter(const Arg *arg)
+ {
+diff --git a/st.h b/st.h
+index 38c61c4..dac64d8 100644
+--- a/st.h
++++ b/st.h
+_AT_@ -80,6 +80,7 @@ void die(const char *, ...);
+ void redraw(void);
+ void draw(void);
+
++void iso14755(const Arg *);
+ void printscreen(const Arg *);
+ void printsel(const Arg *);
+ void sendbreak(const Arg *);
Received on Wed Apr 22 2020 - 15:55:49 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 22 2020 - 16:00:49 CEST