]> jfr.im git - irc/weechat/weechat.git/commit
core: render newline characters in chat line messages
authorTrygve Aaberge <redacted>
Sat, 8 Apr 2023 22:17:52 +0000 (00:17 +0200)
committerSébastien Helleu <redacted>
Wed, 19 Apr 2023 14:47:44 +0000 (16:47 +0200)
commit031bd45e360ce619838d0197442cd39734b0b96f
tree2351ffcb33b4f6b0b256ed5bfb197aacfc56885f
parent2b7f7453692d2325e27e2464e4796b150c708aa4
core: render newline characters in chat line messages

If a chat line message contains a newline character (\n) it was
previously rendered as J with reverse video. This commit makes it
render as an actual newline instead, so messages with multiple lines
become supported.

The rendering is fixed in normal mode as well as bare mode both when
scrolled to the bottom and when scrolled up (which is different code
paths). Focus events has also been updated to support this (except for
_chat_line_y which returns -1 for all lines, but the docs says this
variable is only for buffers with free content).

Currently, the only way to include a \n in a chat line message is with
hdata_update because printf splits on \n and creates multiple separate
lines, but hopefully either printf can be changed to not split on \n, or
a new command which doesn't split can be added.
src/gui/curses/gui-curses-chat.c
src/gui/gui-chat.c
src/gui/gui-chat.h
src/gui/gui-window.c
tests/unit/gui/test-gui-chat.cpp