[2025-08-24 21:35:00] PRZYCINANIE NICKÓW - dodano >> dla długich nicków, build OK

This commit is contained in:
kofany 2025-08-24 23:28:05 +02:00
commit 1fa2f42b6f
3 changed files with 28 additions and 14 deletions

View file

@ -318,6 +318,8 @@ settings = {
print_active_channel = "yes";
theme = "default.theme";
nick_column_enabled = "yes";
nick_column_width = "10";
debug_nick_column = "no";
};
"fe-text" = {
lag_min_show = "1s";

View file

@ -86,9 +86,23 @@ static char *expando_nickalign(SERVER_REC *server, void *item, int *free_ret)
nick_chars = count_nick_chars(current_nick);
total_chars = mode_chars + nick_chars;
padding = width - total_chars;
if (padding < 0) {
padding = 0; /* Nie może być ujemny */
if (total_chars > width) {
/* Nick za długi - przytnij z >> */
int available_for_nick = width - mode_chars - 2; /* -2 dla >> */
if (available_for_nick > 0) {
/* Przytnij nick i dodaj >> */
char *truncated = g_strndup(current_nick, available_for_nick);
g_free(current_nick);
current_nick = g_strdup_printf("%s>>", truncated);
g_free(truncated);
} else {
/* Mode sam za długi */
g_free(current_nick);
current_nick = g_strdup(">>");
}
padding = 0;
} else {
padding = width - total_chars;
}
/* Debug output */

View file

@ -135,15 +135,15 @@ abstracts = {
# privmsgnick = "%K{msgnick %R$*%K}%n";
# $0 = nick mode, $1 = nick
ownmsgnick = "{msgnick %B$0 $1-}";
ownmsgnick = "{msgnick %B$0$1-}";
ownnick = "%_%Y$*%n";
# public message in channel, $0 = nick mode, $1 = nick
pubmsgnick = "{msgnick %M$0%N $1%n }";
pubmsgnick = "{msgnick %M$0%N$1-%n}";
pubnick = "%G$*%n";
# public message in channel meant for me, $0 = nick mode, $1 = nick
pubmsgmenick = "{msgnick $0 $1-}";
pubmsgmenick = "{msgnick $0$1-}";
menick = "%Y$*%n";
# public highlighted message in channel
@ -307,15 +307,13 @@ formats = {
"fe-common/core" = {
own_msg = "$nickalign{ownmsgnick $2 {ownnick $0}}$1";
own_msg_channel = "{ownmsgnick $3 {ownnick $0}{msgchannel $1}}$2";
own_msg_private = "{ownprivmsg msg $0}$1";
own_msg_private_query = "{ownprivmsgnick {ownprivnick $2}}$1";
pubmsg_me = "{pubmsgmenick $2 {menick $0}}$1";
pubmsg_me_channel = "{pubmsgmenick $3 {menick $0}{msgchannel $1}}$2";
pubmsg_hilight = "{pubmsghinick $0 $3 $1}$2";
pubmsg_hilight_channel = "{pubmsghinick $0 $4 $1{msgchannel $2}}$3";
own_msg_channel = "$nickalign{ownmsgnick $3 {ownnick $0}{msgchannel $1}}$2";
pubmsg_me = "$nickalign{pubmsgmenick $2 {menick $0}}$1";
pubmsg_me_channel = "$nickalign{pubmsgmenick $3 {menick $0}{msgchannel $1}}$2";
pubmsg_hilight = "$nickalign{pubmsghinick $0 $3 $1}$2";
pubmsg_hilight_channel = "$nickalign{pubmsghinick $0 $4 $1{msgchannel $2}}$3";
pubmsg = "$nickalign{pubmsgnick $2 {pubnick $0}}$1";
pubmsg_channel = "{pubmsgnick $3 {pubnick $0}{msgchannel $1}}$2";
pubmsg_channel = "$nickalign{pubmsgnick $3 {pubnick $0}{msgchannel $1}}$2";
msg_private = "{privmsg $0 $1}$2";
msg_private_query = "{privmsgnick $0}$2";