Re: [hackers] [tabbed] Makefile: simplify and remove hiding the build process || Hiltjo Posthuma

2022-10-13 Thread Laslo Hunhold
On Wed, 12 Oct 2022 23:02:14 +0200 (CEST)
g...@suckless.org wrote:

> -# Solaris
> -#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
> -#LDFLAGS = ${LIBS}

Noo, not Solaris!



Re: [hackers] [tabbed] bump version to 0.7 || Hiltjo Posthuma

2022-10-13 Thread Joerg Jung


> On 12. Oct 2022, at 23:04, Hiltjo Posthuma  wrote:
> On Wed, Oct 12, 2022 at 08:41:37PM +0200, Joerg Jung wrote:
>> Looks like the 0.7 release tarball seems 
>> to miss the xembed.1 man page.
>> I guess because dist: target in makefile was not
>> updated to include file?
> Thanks for reporting it,

I see you fixed it in repo already, thanks!

Please, can you also do a new release tarball? 
i.e. 0.7.1 or similar, so that this can be packaged/updated 
in distros as well.

Thanks,
Regards
Joerg



Re: [hackers] [tabbed] Makefile: add xembed.1 in the dist target || Hiltjo Posthuma

2022-10-13 Thread Hiltjo Posthuma
On Thu, Oct 13, 2022 at 06:35:32PM +0200, Laslo Hunhold wrote:
> On Thu, 13 Oct 2022 01:09:22 +0200
> Hiltjo Posthuma  wrote:
> 
> Dear Hiltjo,
> 
> > Theres no need for a dependency on git, this way it also works when
> > downloading the tarball and running make dist (just an example).
> 
> maybe overkill for such a package, but maybe adding an explicit MAN1
> array might help.
> 
> With best regards
> 
> Laslo
> 

maybe maybe maybe

-- 
Kind regards,
Hiltjo



[hackers] [lchat] readme: link libgrapheme to project page || Jan Klemkow

2022-10-13 Thread git
commit 8f9d976404ef1c599a2f0939c167e2e2d1408164
Author: Jan Klemkow 
AuthorDate: Thu Oct 13 23:00:52 2022 +0200
Commit: Jan Klemkow 
CommitDate: Thu Oct 13 23:00:52 2022 +0200

readme: link libgrapheme to project page

diff --git a/README.md b/README.md
index f1838ad..81ca537 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ Programs you can use lchat as a front end for:
 Requirements
 
 
- * [libgrapheme](https://git.suckless.org/libgrapheme)
+ * [libgrapheme](https://libs.suckless.org/libgrapheme)
  * tail(1)
  * grep(1)
 



[hackers] [lchat] slackline: remove redundant lines in sl_move() || Tom Schwindl

2022-10-13 Thread git
commit 8573652f3306be2762777fbf98096b9982783bf6
Author: Tom Schwindl 
AuthorDate: Thu Oct 13 16:52:38 2022 +0200
Commit: Jan Klemkow 
CommitDate: Thu Oct 13 22:58:40 2022 +0200

slackline: remove redundant lines in sl_move()

diff --git a/slackline.c b/slackline.c
index d7047a5..4a4a2a9 100644
--- a/slackline.c
+++ b/slackline.c
@@ -124,18 +124,14 @@ sl_move(struct slackline *sl, enum direction dir)
return;
case END:
sl->rcur = sl->rlen;
-   sl->bcur = sl_postobyte(sl, sl->rcur);
-   sl->ptr = sl->buf + sl->bcur;
-   return;
+   break;
case RIGHT:
if (sl->rcur < sl->rlen)
sl->rcur++;
break;
case LEFT:
-   if (sl->rcur > 0) {
+   if (sl->rcur > 0)
sl->rcur--;
-   sl->bcur = sl_postobyte(sl, sl->rcur);
-   }
break;
}
 



[hackers] [lchat] slackline: implement sl_move() to handle cursor movement || Tom Schwindl

2022-10-13 Thread git
commit f7052595cdec83861c5f28bc5e579c6238b5aced
Author: Tom Schwindl 
AuthorDate: Thu Oct 13 16:23:21 2022 +0200
Commit: Jan Klemkow 
CommitDate: Thu Oct 13 22:58:40 2022 +0200

slackline: implement sl_move() to handle cursor movement

diff --git a/slackline.c b/slackline.c
index b43b71c..d7047a5 100644
--- a/slackline.c
+++ b/slackline.c
@@ -24,6 +24,8 @@
 
 #include "slackline.h"
 
+enum direction {LEFT, RIGHT, HOME, END};
+
 struct slackline *
 sl_init(void)
 {
@@ -112,6 +114,35 @@ sl_backspace(struct slackline *sl)
sl->ptr = ncur;
 }
 
+static void
+sl_move(struct slackline *sl, enum direction dir)
+{
+   switch (dir) {
+   case HOME:
+   sl->bcur = sl->rcur = 0;
+   sl->ptr = sl->buf;
+   return;
+   case END:
+   sl->rcur = sl->rlen;
+   sl->bcur = sl_postobyte(sl, sl->rcur);
+   sl->ptr = sl->buf + sl->bcur;
+   return;
+   case RIGHT:
+   if (sl->rcur < sl->rlen)
+   sl->rcur++;
+   break;
+   case LEFT:
+   if (sl->rcur > 0) {
+   sl->rcur--;
+   sl->bcur = sl_postobyte(sl, sl->rcur);
+   }
+   break;
+   }
+
+   sl->bcur = sl_postobyte(sl, sl->rcur);
+   sl->ptr = sl->buf + sl->bcur;
+}
+
 int
 sl_keystroke(struct slackline *sl, int key)
 {
@@ -133,39 +164,22 @@ sl_keystroke(struct slackline *sl, int key)
case 'B':   /* down  */
break;
case 'C':   /* right */
-   if (sl->rcur < sl->rlen)
-   sl->rcur++;
-   sl->bcur = sl_postobyte(sl, sl->rcur);
-   sl->ptr = sl->buf + sl->bcur;
+   sl_move(sl, RIGHT);
break;
case 'D':   /* left */
-   if (sl->rcur > 0)
-   sl->rcur--;
-   sl->bcur = sl_postobyte(sl, sl->rcur);
-   sl->ptr = sl->buf + sl->bcur;
+   sl_move(sl, LEFT);
break;
case 'H':   /* Home  */
-   sl->bcur = sl->rcur = 0;
-   sl->ptr = sl->buf;
+   sl_move(sl, HOME);
break;
case 'F':   /* End   */
-   sl->rcur = sl->rlen;
-   sl->bcur = sl_postobyte(sl, sl->rcur);
-   sl->ptr = sl->buf + sl->bcur;
+   sl_move(sl, END);
break;
case 'P':   /* delete */
if (sl->rcur == sl->rlen)
break;
-
-   char *ncur = sl_postoptr(sl, sl->rcur + 1);
-
-   memmove(sl->ptr, ncur, sl->last - ncur);
-
-   sl->rlen--;
-   sl->blen = sl_postobyte(sl, sl->rlen);
-
-   sl->last -= ncur - sl->ptr;
-   *sl->last = '\0';
+   sl_move(sl, RIGHT);
+   sl_backspace(sl);
break;
case '0':
case '1':
@@ -188,13 +202,10 @@ sl_keystroke(struct slackline *sl, int key)
case '~':
switch(sl->nummod) {
case '7':
-   sl->bcur = sl->rcur = 0;
-   sl->ptr = sl->buf;
+   sl_move(sl, HOME);
break;
case '8':
-   sl->rcur = sl->rlen;
-   sl->bcur = sl_postobyte(sl, sl->rcur);
-   sl->ptr = sl->buf + sl->bcur;
+   sl_move(sl, END);
break;
}
sl->esc = ESC_NONE;



[hackers] [libgrapheme/bidirectional] Update README to reflect the ./configure-script || Laslo Hunhold

2022-10-13 Thread git
commit a591d58a3fb3abf40956c3017118da7f33a84bea
Author: Laslo Hunhold 
AuthorDate: Tue Oct 11 23:21:54 2022 +0200
Commit: Laslo Hunhold 
CommitDate: Tue Oct 11 23:21:54 2022 +0200

Update README to reflect the ./configure-script

Signed-off-by: Laslo Hunhold 

diff --git a/README b/README
index 9f655e9..ae8e959 100644
--- a/README
+++ b/README
@@ -36,8 +36,9 @@ A C99-compiler and POSIX make.
 
 Installation
 
-Edit config.mk to match your local setup (usually not necessary, the
-default prefix is /usr/local).
+Run ./configure, which automatically edits config.mk to match your local
+setup. Edit config.mk by hand if necessary or desired for further
+customization.
 
 Afterwards enter the following command to build and install libgrapheme
 (if necessary as root):



[hackers] [libgrapheme/bidirectional] Refactor src/bidirectional.c with Herodotus || Laslo Hunhold

2022-10-13 Thread git
commit dd15fea026c3e0b389381ae8cc08e0f39fa1a8f7
Author: Laslo Hunhold 
AuthorDate: Fri Oct 14 00:40:37 2022 +0200
Commit: Laslo Hunhold 
CommitDate: Fri Oct 14 00:41:37 2022 +0200

Refactor src/bidirectional.c with Herodotus

This simplifies a lot of the code and makes it more consistent as it now
uses patterns that are similar to those in src/case.c.

The most significant effect is of course the guarantees that come with
using this interface.

Signed-off-by: Laslo Hunhold 

diff --git a/src/bidirectional.c b/src/bidirectional.c
index c915c75..d383b3c 100644
--- a/src/bidirectional.c
+++ b/src/bidirectional.c
@@ -24,22 +24,26 @@ get_bidi_property(uint_least32_t cp)
  * https://unicode.org/reports/tr9/
  * https://github.com/omid/Persian-Log2Vis/blob/master/bidi.php
  * https://github.com/fribidi/fribidi/blob/master/lib/fribidi.h
+ *
+ * Apply transformation separately
+ * src, dest=111000111111 -> get contiguous blocks and apply
+ * investigate fribidi and refactor API
  */
 
 #define MAX_DEPTH 125
 
-#include  /* 
-- */
-static size_t
-determine_paragraph_level(const void *src, size_t srclen,
-  size_t (*get_codepoint)(const void *, size_t, 
size_t, uint_least32_t *),
-  size_t (*set_codepoint)(uint_least32_t, void *, 
size_t, size_t))
+static uint8_t
+determine_paragraph_level(const HERODOTUS_READER *r)
 {
+   HERODOTUS_READER tmp;
enum bidi_property prop;
-   size_t srcoff, isolate_level;
+   uint8_t isolate_level;
uint_least32_t cp;
 
-   for (srcoff = 0, isolate_level = 0; srcoff < srclen; ) {
-   srcoff += get_codepoint(src, srclen, srcoff, );
+   herodotus_reader_copy(r, );
+
+   for (isolate_level = 0; herodotus_read_codepoint(, true, ) ==
+HERODOTUS_STATUS_SUCCESS; ) {
prop = get_bidi_property(cp);
 
/* BD8/BD9 */
@@ -70,27 +74,21 @@ determine_paragraph_level(const void *src, size_t srclen,
return 0;
 }
 
-static size_t
-handle_paragraph(const void *src, size_t srclen, enum 
grapheme_bidirectional_override override,
- size_t (*get_codepoint)(const void *, size_t, size_t, 
uint_least32_t *),
- size_t (*set_codepoint)(uint_least32_t, void *, size_t, 
size_t),
- void *dest, size_t destlen)
+static void
+handle_paragraph(HERODOTUS_READER *r, enum grapheme_bidirectional_override 
override,
+ HERODOTUS_WRITER *w)
 {
enum bidi_property prop;
-   size_t srcoff, destoff, paragraph_level;
+   uint8_t paragraph_level;
 
-fprintf(stderr, "paragraph-call: par='%.*s'\n", (int)srclen, (const char 
*)src);
/* determine paragraph level (rules P1-P3, HL1) */
if (override == GRAPHEME_BIDIRECTIONAL_OVERRIDE_LTR) {
paragraph_level = 0;
} else if (override == GRAPHEME_BIDIRECTIONAL_OVERRIDE_RTL) {
paragraph_level = 1;
} else { /* GRAPHEME_BIDIRECTIONAL_OVERRIDE_NONE and invalid */
-   paragraph_level = determine_paragraph_level(src, srclen,
-   get_codepoint,
-   set_codepoint);
+   paragraph_level = determine_paragraph_level(r);
}
-fprintf(stderr, "\tparagraph_level=%zu\n", paragraph_level);
 
/* determine_explicit_levels(...); X1-X8 */
/* prepare_implicit_processing(); X9-X10, BD13 */
@@ -98,53 +96,39 @@ fprintf(stderr, "\tparagraph_level=%zu\n", paragraph_level);
/* resolve_neutral_and_isolate_formatting_types() N0-N2 */
/* resolve_implicit_levels(); I1-I2 */
/* reorder_resolved_levels(); L1-L4 */
-
-   return destoff;
 }
 
 static size_t
-logical_to_visual(const void *src, size_t srclen, enum 
grapheme_bidirectional_override override,
-  size_t (*get_codepoint)(const void *, size_t, size_t, 
uint_least32_t *),
-  size_t (*set_codepoint)(uint_least32_t, void *, size_t, 
size_t),
-  void *dest, size_t destlen)
+next_paragraph_break(const HERODOTUS_READER *r)
 {
-   size_t srcoff, destoff, lastparoff;
+   HERODOTUS_READER tmp;
uint_least32_t cp;
 
-   for (srcoff = destoff = lastparoff = 0; srcoff < srclen; ) {
-   srcoff += get_codepoint(src, srclen, srcoff, );
+   herodotus_reader_copy(r, );
 
-   /* P1 */
-   if (get_bidi_property(cp) == BIDI_PROP_B ||
-   srcoff == srclen ||
-   (get_codepoint == get_codepoint_utf8 &&
-srclen == SIZE_MAX && cp == 0)) {
-   /*
-* we encountered a paragraph separator or
-* reached the end of the text.
-* Call the paragraph handling function on
-