1 |
commit: c38398c7c3f3ad9aaa82b14f3c2bc9fc6055da15 |
2 |
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 1 05:21:12 2018 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 1 05:21:48 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c38398c7 |
7 |
|
8 |
app-shells/fzy: add snapshot with working utf-8 |
9 |
|
10 |
Package-Manager: Portage-2.3.41, Repoman-2.3.9 |
11 |
|
12 |
app-shells/fzy/Manifest | 1 + |
13 |
app-shells/fzy/files/fzy-add-utf-8-support.patch | 89 ++++++++++++++++++++++++ |
14 |
app-shells/fzy/fzy-0.10_pre20180618.ebuild | 40 +++++++++++ |
15 |
3 files changed, 130 insertions(+) |
16 |
|
17 |
diff --git a/app-shells/fzy/Manifest b/app-shells/fzy/Manifest |
18 |
index 2c36f43eab6..9aefd251ac6 100644 |
19 |
--- a/app-shells/fzy/Manifest |
20 |
+++ b/app-shells/fzy/Manifest |
21 |
@@ -1 +1,2 @@ |
22 |
DIST fzy-0.9.tar.gz 42992 BLAKE2B ebc7e73e0387101da65896a4108705048bb72b01261ea86a0abeaee22fe4517ac54351d508bb79419b05a15aa9c93c5d815c34d15353d01c02381e5d342e75b7 SHA512 71a44bc3bbef3a2d82476a69b5c9e28753e760bbb8d453a9e44b57f34a79dd8ebcd510a869dfeae95f522ba6ccb4b8f10f79c081ce6bc6cfae9a41f4071fefc0 |
23 |
+DIST fzy-2697c02618d908e5bdcae93ab4815b04c49bd25e.tar.gz 45814 BLAKE2B bb4dbc668dd93c71d16c3affdaf148212e3fbdef27110314b8145fd4a20991bb368f7aef1d1f7bd147afa23900800c468b4d9b2999de2226ce9a312a02d344b4 SHA512 34520dc3b4bcbad3479cce1fbeb014b1851edc1b1f4460c21a645297bf9ec01a1483f108a562f6ac6d3c0def97427740b74e9a3b83c85223d14ac3e1586e3d8e |
24 |
|
25 |
diff --git a/app-shells/fzy/files/fzy-add-utf-8-support.patch b/app-shells/fzy/files/fzy-add-utf-8-support.patch |
26 |
new file mode 100644 |
27 |
index 00000000000..886957379a8 |
28 |
--- /dev/null |
29 |
+++ b/app-shells/fzy/files/fzy-add-utf-8-support.patch |
30 |
@@ -0,0 +1,89 @@ |
31 |
+From 8dd7a9f49c2b65f28025902106f364ff11d4170d Mon Sep 17 00:00:00 2001 |
32 |
+From: syrrim <syrrim0@×××××.com> |
33 |
+Date: Mon, 23 Apr 2018 01:25:48 -0400 |
34 |
+Subject: [PATCH] add utf-8 support to input, fixes #21 |
35 |
+ |
36 |
+- non ascii bytes won't be ignored |
37 |
+- one can seek over and delete whole utf-8 codepoints at a time |
38 |
+- the cursor will be positioned properly around double width chars |
39 |
+--- |
40 |
+ src/tty_interface.c | 31 ++++++++++++++++++++++++++----- |
41 |
+ 1 file changed, 26 insertions(+), 5 deletions(-) |
42 |
+ |
43 |
+diff --git a/src/tty_interface.c b/src/tty_interface.c |
44 |
+index a7d506e..35f2919 100644 |
45 |
+--- a/src/tty_interface.c |
46 |
++++ b/src/tty_interface.c |
47 |
+@@ -7,6 +7,14 @@ |
48 |
+ #include "tty_interface.h" |
49 |
+ #include "../config.h" |
50 |
+ |
51 |
++static int isprint_unicode(char c){ |
52 |
++ return isprint(c) || c & (1<<7); |
53 |
++} |
54 |
++ |
55 |
++static int is_boundary(char c) { |
56 |
++ return ~c & (1<<7) || c & (1<<6); |
57 |
++} |
58 |
++ |
59 |
+ static void clear(tty_interface_t *state) { |
60 |
+ tty_t *tty = state->tty; |
61 |
+ |
62 |
+@@ -95,7 +103,10 @@ static void draw(tty_interface_t *state) { |
63 |
+ tty_moveup(tty, num_lines); |
64 |
+ } |
65 |
+ |
66 |
+- tty_setcol(tty, strlen(options->prompt) + state->cursor); |
67 |
++ tty_setcol(tty, 0); |
68 |
++ fputs(options->prompt, tty->fout); |
69 |
++ for(size_t i=0; i<state->cursor; i++) |
70 |
++ fputc(state->search[i], tty->fout); |
71 |
+ tty_flush(tty); |
72 |
+ } |
73 |
+ |
74 |
+@@ -138,9 +149,13 @@ static void action_del_char(tty_interface_t *state) { |
75 |
+ if(state->cursor == 0) { |
76 |
+ return; |
77 |
+ } |
78 |
++ size_t original_cursor = state->cursor; |
79 |
+ |
80 |
+ state->cursor--; |
81 |
+- memmove(&state->search[state->cursor], &state->search[state->cursor + 1], length - state->cursor); |
82 |
++ while(!is_boundary(state->search[state->cursor]) && state->cursor) |
83 |
++ state->cursor--; |
84 |
++ |
85 |
++ memmove(&state->search[state->cursor], &state->search[original_cursor], length - original_cursor + 1); |
86 |
+ } |
87 |
+ } |
88 |
+ |
89 |
+@@ -178,13 +193,19 @@ static void action_next(tty_interface_t *state) { |
90 |
+ } |
91 |
+ |
92 |
+ static void action_left(tty_interface_t *state) { |
93 |
+- if (state->cursor > 0) |
94 |
++ if (state->cursor > 0){ |
95 |
+ state->cursor--; |
96 |
++ while(!is_boundary(state->search[state->cursor]) && state->cursor) |
97 |
++ state->cursor--; |
98 |
++ } |
99 |
+ } |
100 |
+ |
101 |
+ static void action_right(tty_interface_t *state) { |
102 |
+- if (state->cursor < strlen(state->search)) |
103 |
++ if (state->cursor < strlen(state->search)){ |
104 |
+ state->cursor++; |
105 |
++ while(!is_boundary(state->search[state->cursor])) |
106 |
++ state->cursor++; |
107 |
++ } |
108 |
+ } |
109 |
+ |
110 |
+ static void action_beginning(tty_interface_t *state) { |
111 |
+@@ -315,7 +336,7 @@ static void handle_input(tty_interface_t *state, const char *s) { |
112 |
+ |
113 |
+ /* No matching keybinding, add to search */ |
114 |
+ for (int i = 0; input[i]; i++) |
115 |
+- if (isprint(input[i])) |
116 |
++ if (isprint_unicode(input[i])) |
117 |
+ append_search(state, input[i]); |
118 |
+ |
119 |
+ /* We have processed the input, so clear it */ |
120 |
|
121 |
diff --git a/app-shells/fzy/fzy-0.10_pre20180618.ebuild b/app-shells/fzy/fzy-0.10_pre20180618.ebuild |
122 |
new file mode 100644 |
123 |
index 00000000000..1e4cb47604e |
124 |
--- /dev/null |
125 |
+++ b/app-shells/fzy/fzy-0.10_pre20180618.ebuild |
126 |
@@ -0,0 +1,40 @@ |
127 |
+# Copyright 1999-2018 Gentoo Foundation |
128 |
+# Distributed under the terms of the GNU General Public License v2 |
129 |
+ |
130 |
+EAPI=6 |
131 |
+ |
132 |
+inherit savedconfig toolchain-funcs |
133 |
+ |
134 |
+EGIT_COMMIT="2697c02618d908e5bdcae93ab4815b04c49bd25e" |
135 |
+ |
136 |
+DESCRIPTION="Fuzzy text selector (interactive grep) for console" |
137 |
+HOMEPAGE="https://github.com/jhawthorn/fzy" |
138 |
+SRC_URI="https://github.com/jhawthorn/fzy/archive/${EGIT_COMMIT}.tar.gz -> ${PN}-${EGIT_COMMIT}.tar.gz" |
139 |
+ |
140 |
+LICENSE="MIT" |
141 |
+SLOT="0" |
142 |
+KEYWORDS="~amd64 ~x86" |
143 |
+IUSE="test" |
144 |
+ |
145 |
+PATCHES=( |
146 |
+ "${FILESDIR}"/fzy-0.9-cflags.patch |
147 |
+ "${FILESDIR}"/fzy-add-utf-8-support.patch |
148 |
+) |
149 |
+ |
150 |
+S="${WORKDIR}/${PN}-${EGIT_COMMIT}" |
151 |
+ |
152 |
+src_prepare() { |
153 |
+ default |
154 |
+ restore_config config.h |
155 |
+ tc-export CC |
156 |
+} |
157 |
+ |
158 |
+src_install() { |
159 |
+ local DOCS=( ALGORITHM.md CHANGELOG.md README.md ) |
160 |
+ emake DESTDIR="${D}" PREFIX="${EPREFIX}"/usr install |
161 |
+ exeinto /usr/share/fzy |
162 |
+ doexe contrib/fzy-tmux |
163 |
+ doexe contrib/fzy-dvtm |
164 |
+ einstalldocs |
165 |
+ save_config config.h |
166 |
+} |