summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Yakovlev <gyakovlev@gentoo.org>2018-06-30 22:21:12 -0700
committerGeorgy Yakovlev <gyakovlev@gentoo.org>2018-06-30 22:21:48 -0700
commitc38398c7c3f3ad9aaa82b14f3c2bc9fc6055da15 (patch)
tree33923db1a7e4041e03f28e118e39681d0484f322 /app-shells
parentapp-shells/fzy: add live ebuild (diff)
downloadgentoo-c38398c7c3f3ad9aaa82b14f3c2bc9fc6055da15.tar.gz
gentoo-c38398c7c3f3ad9aaa82b14f3c2bc9fc6055da15.tar.bz2
gentoo-c38398c7c3f3ad9aaa82b14f3c2bc9fc6055da15.zip
app-shells/fzy: add snapshot with working utf-8
Package-Manager: Portage-2.3.41, Repoman-2.3.9
Diffstat (limited to 'app-shells')
-rw-r--r--app-shells/fzy/Manifest1
-rw-r--r--app-shells/fzy/files/fzy-add-utf-8-support.patch89
-rw-r--r--app-shells/fzy/fzy-0.10_pre20180618.ebuild40
3 files changed, 130 insertions, 0 deletions
diff --git a/app-shells/fzy/Manifest b/app-shells/fzy/Manifest
index 2c36f43eab64..9aefd251ac68 100644
--- a/app-shells/fzy/Manifest
+++ b/app-shells/fzy/Manifest
@@ -1 +1,2 @@
DIST fzy-0.9.tar.gz 42992 BLAKE2B ebc7e73e0387101da65896a4108705048bb72b01261ea86a0abeaee22fe4517ac54351d508bb79419b05a15aa9c93c5d815c34d15353d01c02381e5d342e75b7 SHA512 71a44bc3bbef3a2d82476a69b5c9e28753e760bbb8d453a9e44b57f34a79dd8ebcd510a869dfeae95f522ba6ccb4b8f10f79c081ce6bc6cfae9a41f4071fefc0
+DIST fzy-2697c02618d908e5bdcae93ab4815b04c49bd25e.tar.gz 45814 BLAKE2B bb4dbc668dd93c71d16c3affdaf148212e3fbdef27110314b8145fd4a20991bb368f7aef1d1f7bd147afa23900800c468b4d9b2999de2226ce9a312a02d344b4 SHA512 34520dc3b4bcbad3479cce1fbeb014b1851edc1b1f4460c21a645297bf9ec01a1483f108a562f6ac6d3c0def97427740b74e9a3b83c85223d14ac3e1586e3d8e
diff --git a/app-shells/fzy/files/fzy-add-utf-8-support.patch b/app-shells/fzy/files/fzy-add-utf-8-support.patch
new file mode 100644
index 000000000000..886957379a83
--- /dev/null
+++ b/app-shells/fzy/files/fzy-add-utf-8-support.patch
@@ -0,0 +1,89 @@
+From 8dd7a9f49c2b65f28025902106f364ff11d4170d Mon Sep 17 00:00:00 2001
+From: syrrim <syrrim0@gmail.com>
+Date: Mon, 23 Apr 2018 01:25:48 -0400
+Subject: [PATCH] add utf-8 support to input, fixes #21
+
+- non ascii bytes won't be ignored
+- one can seek over and delete whole utf-8 codepoints at a time
+- the cursor will be positioned properly around double width chars
+---
+ src/tty_interface.c | 31 ++++++++++++++++++++++++++-----
+ 1 file changed, 26 insertions(+), 5 deletions(-)
+
+diff --git a/src/tty_interface.c b/src/tty_interface.c
+index a7d506e..35f2919 100644
+--- a/src/tty_interface.c
++++ b/src/tty_interface.c
+@@ -7,6 +7,14 @@
+ #include "tty_interface.h"
+ #include "../config.h"
+
++static int isprint_unicode(char c){
++ return isprint(c) || c & (1<<7);
++}
++
++static int is_boundary(char c) {
++ return ~c & (1<<7) || c & (1<<6);
++}
++
+ static void clear(tty_interface_t *state) {
+ tty_t *tty = state->tty;
+
+@@ -95,7 +103,10 @@ static void draw(tty_interface_t *state) {
+ tty_moveup(tty, num_lines);
+ }
+
+- tty_setcol(tty, strlen(options->prompt) + state->cursor);
++ tty_setcol(tty, 0);
++ fputs(options->prompt, tty->fout);
++ for(size_t i=0; i<state->cursor; i++)
++ fputc(state->search[i], tty->fout);
+ tty_flush(tty);
+ }
+
+@@ -138,9 +149,13 @@ static void action_del_char(tty_interface_t *state) {
+ if(state->cursor == 0) {
+ return;
+ }
++ size_t original_cursor = state->cursor;
+
+ state->cursor--;
+- memmove(&state->search[state->cursor], &state->search[state->cursor + 1], length - state->cursor);
++ while(!is_boundary(state->search[state->cursor]) && state->cursor)
++ state->cursor--;
++
++ memmove(&state->search[state->cursor], &state->search[original_cursor], length - original_cursor + 1);
+ }
+ }
+
+@@ -178,13 +193,19 @@ static void action_next(tty_interface_t *state) {
+ }
+
+ static void action_left(tty_interface_t *state) {
+- if (state->cursor > 0)
++ if (state->cursor > 0){
+ state->cursor--;
++ while(!is_boundary(state->search[state->cursor]) && state->cursor)
++ state->cursor--;
++ }
+ }
+
+ static void action_right(tty_interface_t *state) {
+- if (state->cursor < strlen(state->search))
++ if (state->cursor < strlen(state->search)){
+ state->cursor++;
++ while(!is_boundary(state->search[state->cursor]))
++ state->cursor++;
++ }
+ }
+
+ static void action_beginning(tty_interface_t *state) {
+@@ -315,7 +336,7 @@ static void handle_input(tty_interface_t *state, const char *s) {
+
+ /* No matching keybinding, add to search */
+ for (int i = 0; input[i]; i++)
+- if (isprint(input[i]))
++ if (isprint_unicode(input[i]))
+ append_search(state, input[i]);
+
+ /* We have processed the input, so clear it */
diff --git a/app-shells/fzy/fzy-0.10_pre20180618.ebuild b/app-shells/fzy/fzy-0.10_pre20180618.ebuild
new file mode 100644
index 000000000000..1e4cb47604e9
--- /dev/null
+++ b/app-shells/fzy/fzy-0.10_pre20180618.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit savedconfig toolchain-funcs
+
+EGIT_COMMIT="2697c02618d908e5bdcae93ab4815b04c49bd25e"
+
+DESCRIPTION="Fuzzy text selector (interactive grep) for console"
+HOMEPAGE="https://github.com/jhawthorn/fzy"
+SRC_URI="https://github.com/jhawthorn/fzy/archive/${EGIT_COMMIT}.tar.gz -> ${PN}-${EGIT_COMMIT}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="test"
+
+PATCHES=(
+ "${FILESDIR}"/fzy-0.9-cflags.patch
+ "${FILESDIR}"/fzy-add-utf-8-support.patch
+)
+
+S="${WORKDIR}/${PN}-${EGIT_COMMIT}"
+
+src_prepare() {
+ default
+ restore_config config.h
+ tc-export CC
+}
+
+src_install() {
+ local DOCS=( ALGORITHM.md CHANGELOG.md README.md )
+ emake DESTDIR="${D}" PREFIX="${EPREFIX}"/usr install
+ exeinto /usr/share/fzy
+ doexe contrib/fzy-tmux
+ doexe contrib/fzy-dvtm
+ einstalldocs
+ save_config config.h
+}