Re: [dev] [st] [PATCH] Correct shift amount on MODE_INSERT in tputc()

From: Rian Hunter <rian+suckless-dev_AT_thelig.ht>
Date: Fri, 30 Jan 2015 09:53:41 -0800

On Fri, Jan 30, 2015 at 12:19:18PM +0100, k0ga_AT_shike2.com wrote:
> > On Fri, Jan 30, 2015 at 12:41 AM, FRIGN <dev_AT_frign.de> wrote:
> >> On Thu, 29 Jan 2015 15:08:39 -0800
> >> Rian Hunter <rian+suckless-dev_AT_thelig.ht> wrote:
> >>
> >>> When MODE_INSERT is set we'd shift characters on the same
> >>> line forward before inserting our character in tputc().
> >>> This did not account for wide characters where width != 1.
> >>> This patch makes it so we shift the correct amount.
> >>
>
> Good catch, I'll test the patches this weekend (I am a bit
> busy now). I think we can have this problem in other places,
> maybe could be a good idea test all the places where we have
> a +1.
>

Thanks for the feedback everyone. Glad to contribute, st is literally the only
sane freely available graphical terminal emulator in existence.

The original code still looks a bit fishy to me. It looks like there could be
a situation where two newlines are written when a single character is inserted
(e.g. when term.col < width). From reading the code, terminal emulation seems
complex and it was hard to infer the correct behavior without knowing
every use case in which the various combinations of MODE_INSERT/MODE_WRAP
apply. My best theory is that MODE_WRAP is redundant though that seems wrong.

I'd really appreciate it if there were a longer comment detailing how
word wrap, auto newline insertion, and overflow handling are supposed to be
handled in st.

> >> However, next time, please attach the patches
> >> instead of inserting them so people with insane
> >> mail clients can easily access them without hassle.
> >
> > I don't think we should encourage this behavior on this list.
> > Shouldn't we rather assume that people on this list are using sane
> > mail clients that let them easily save their mails to disk so that
> > they can use 'git am' to apply them?
> >
>
> I agree with Silvan. Patches in the body simplify the discussion,
> and we should benefit people that use sane mail clients instead
> of people don't do it.
>

FWIW I also agree. For a discussion list inline patches seem to make more
sense. Although, I think a lot of people use webmail clients and they
usually don't format plain text in fixed-width so that makes inline
code a visual nightmare. I'm happy to do whatever though as long as
people can read and comment on my patches.
Received on Fri Jan 30 2015 - 18:53:41 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 30 2015 - 19:00:10 CET