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

From: <>
Date: Wed, 4 Feb 2015 10:25:23 +0100

> 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.

There are some parts that could be written better, but there are some
points that are ugly only because vt100 was ugly. One of them is the
line wrap handling, because the new line is not inserted when you
arrive to the end of the line, it is inserted when you try to write in
one position after the end. It means that cursor stands in the last
position of the line when you write it, so the position of the cursor
is not incremented. This is the reason why MODE_WRAP is needed,
because you need to differenciate between column 79 with wrap or
without wrap.

MODE_INSERT is not related to the wrap, is about if new text overwrite
previous text or is inserted before it. If you have some doubts about some
flag usually the best place where search is in tsetmode, where you can see
what is the sequence (all the sequences are documented with the
ANSI name), that set the flag. You only have to go to vt100 documentation
to see what is the purpouse of the sequence. In this case they are

> 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.

was your previous comment about line wrapping or about word wrapping
in text selection?, MODE_WRAP is about line wrap when you insert new

I have applied your patches and I think they are correct, so I will pushed
them to the suckless repository this evening.

If you need more hins about the code of st ask me, and I wll answer

Received on Wed Feb 04 2015 - 10:25:23 CET

This archive was generated by hypermail 2.3.0 : Wed Feb 04 2015 - 10:36:07 CET