mIRC Home    About    Download    Register    News    Help

Print Thread
#271560 14/04/23 06:03 PM
Joined: Aug 2016
Posts: 59
R
Babel fish
OP Offline
Babel fish
R
Joined: Aug 2016
Posts: 59
I've wanted to report this bug for some time, but my laziness wouldn't let me. Since version 7.64 mIRC supports preserving colors in $wrap and since then it doesn't work correctly.

I will publish prints to better illustrate...

mIRC 7.63 $wrap - Here is expected behavior
Code
alias testwrap {
  set -l %frase 9,37 😺 37    13Testtest      9😻 37www.9testtest.com     9😽  13Testtest 9$Test 13 É o 1º projeto 3,8 100% 8,3 <12@8> 3,8 Brasileiro 12 rodando na rede 0,59  🧊 Fantom Opera   13Agora também no 40,15 IR41C . 59Canal do Telegram ⇨ 9https://t.me/testtest
  set -l %x 1
  echo -ea %frase
  while $wrap(%frase, $window($active).font, $window($active).fontsize, 400, 1, %x) {
    echo -a $v1
    inc %x
  }
}
https://snipboard.io/pHjnVr.jpg

mIRC 7.63 $wrap2 (available here http://hawkee.com/snippet/17956/) - Here correctly preserves the control codes
Code
alias wrap2 {
  if (!$isid) return
  if ($3 !isnum) || ($4 !isnum) || ($5 !isnum) || (($6) && ($6 !isnum)) {
    echo -esc info * Invalid parameters: $!wrap2
    halt
  }
  set -l %n $5
  set -l %wrap $!wrap($1,$2,$3,$4,%n)
  if ($6 != $null) {
    %n = $6
    %wrap = $!wrap($1,$2,$3,$4,$5,%n)
  }
  if (%n < 1) return [ [ %wrap ] ]
  set -l %t %n
  %n = 1
  while (%n < %t) {
    set -l %m $gettok(%r $+ [ [ %wrap ] ],-1,15)
    set -l %r
    if (2 \\ $count(%m,$chr(2))) %r = $chr(2)
    if (2 \\ $count(%m,$chr(31))) %r = $+(%r,$chr(31))
    if (2 \\ $count(%m,$chr(29))) %r = $+(%r,$chr(29))
    if (2 \\ $count(%m,$chr(22))) %r = $+(%r,$chr(22))
    set -l %x $count(%m,$chr(3))
    if (!%x) goto b
    if (!$regex(k,$mid(%m,$pos(%m,$chr(3),%x),3),/^\x03(\d\d?)/)) goto b
    %r = $+(%r,$chr(3),$base($regml(k,1),10,10,2))
    :a
    if ($regex(k,$mid(%m,$pos(%m,$chr(3),%x),6),/^\x03(\d\d?)(?:\x2c(\d\d?))?/)) && ($regml(k,2) != $null) %r = $+(%r,$chr(44),$base($v1,10,10,2))
    elseif ($regml(k,0) == 1) && (%x > 1) {
      dec %x
      goto a
    }
    :b
    inc %n
  }
  if ([ [ %wrap ] ] != $null) return %r $+ $v1
}

alias testwrap {
  set -l %frase 9,37 😺 37    13Testtest      9😻 37www.9testtest.com     9😽  13Testtest 9$Test 13 É o 1º projeto 3,8 100% 8,3 <12@8> 3,8 Brasileiro 12 rodando na rede 0,59  🧊 Fantom Opera   13Agora também no 40,15 IR41C . 59Canal do Telegram ⇨ 9https://t.me/testtest
  set -l %x 1
  echo -ea %frase
  while $wrap2(%frase, $window($active).font, $window($active).fontsize, 400, 1, %x) {
    echo -a $v1
    inc %x
  }
}
https://snipboard.io/sBAFze.jpg

Finally, mIRC 7.72 $wrap
Code
alias testwrap {
  set -l %frase 9,37 😺 37    13Testtest      9😻 37www.9testtest.com     9😽  13Testtest 9$Test 13 É o 1º projeto 3,8 100% 8,3 <12@8> 3,8 Brasileiro 12 rodando na rede 0,59  🧊 Fantom Opera   13Agora também no 40,15 IR41C . 59Canal do Telegram ⇨ 9https://t.me/testtest
  set -l %bold $iif($window($active).fontbold, 1, 0)
  set -l %italic $iif($window($active).fontitalic, 1, 0)
  set -l %x 1
  echo -ea %frase
  while $wrap(%frase, $window($active).font, $window($active).fontsize, 400, $+(b,%bold,i,%italic,p1t1w1), %x) {
    echo -a $v1
    inc %x
  }
}
https://snipboard.io/PhL4Bc.jpg


rockcavera
#Scripts @ irc.VirtuaLife.com.br
Joined: Dec 2002
Posts: 5,477
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,477
Thanks this has been fixed for the next version.

Joined: Aug 2016
Posts: 59
R
Babel fish
OP Offline
Babel fish
R
Joined: Aug 2016
Posts: 59
I ended up being a little too concise. If there are any doubts about the 3 codes and the error, here I will explain the situation a little better.

On "mIRC 7.63 $wrap - Here is expected behavior", it's $wrap being used, but not preserving the control codes, as this was the normal behavior in version 7.63. Remember that in 7.63 the $wrap syntax was: $wrap(text, font, size, width, [word,] N), "If the optional word parameter is 1, text is wrapped at whole words (which is the default).". Well, this is the case of the first print and the first case. It is used for illustration purposes only and does not imply that there is a problem with it.

On "mIRC 7.63 $wrap2 (available here http://hawkee.com/snippet/17956/) - Here correctly preserves the control codes", the code provides a $wrap2 that uses the $wrap to make the cuts. This code is part of the report to demonstrate how the $wrap should be preserving the control codes. That is, it is expected behavior when $wrap preserves control codes. See the last line of the print, the background is white, just like the original line that was printed in full.

On "Finally, mIRC 7.72 $wrap", the code used is practically the same as in the first case, but as the $wrap syntax has changed, now it is $wrap(text, font, size, width, biptw, N), some additions were needed for bold and italics. The print shows in the last line a gray background and a bold that shouldn't be there, to check it just see the first line of the print, in which the entire line is printed without cuts.


These are three different codes, but necessary as the behavior of mIRC in 7.63 and 7.72 (7.64) has changed to $wrap. Since $wrap2 is just to illustrate how $wrap is expected to look while preserving control codes.

I hope I clarified everything better now.


rockcavera
#Scripts @ irc.VirtuaLife.com.br
Joined: Aug 2016
Posts: 59
R
Babel fish
OP Offline
Babel fish
R
Joined: Aug 2016
Posts: 59
I tested mIRC 7.72.2363 with the code:
Code
alias testwrap {
  set -l %frase 9,37 😺 37    13Testtest      9😻 37www.9testtest.com     9😽  13Testtest 9$Test 13 É o 1º projeto 3,8 100% 8,3 <12@8> 3,8 Brasileiro 12 rodando na rede 0,59  🧊 Fantom Opera   13Agora também no 40,15 IR41C . 59Canal do Telegram ⇨ 9https://t.me/testtest
  set -l %bold $iif($window($active).fontbold, 1, 0)
  set -l %italic $iif($window($active).fontitalic, 1, 0)
  set -l %x 1
  echo -ea %frase
  while $wrap(%frase, $window($active).font, $window($active).fontsize, 400, $+(b,%bold,i,%italic,p1t1w1), %x) {
    echo -a $v1
    inc %x
  }
}
The gray background has been fixed, however, a ctrl+b is still passed to the last line that shouldn't be there. See the print: https://snipboard.io/eqJB3g.jpg


rockcavera
#Scripts @ irc.VirtuaLife.com.br
Joined: Dec 2002
Posts: 5,477
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,477
Thanks for testing. This should be fixed in the next beta.

Joined: Feb 2023
Posts: 43
Ameglian cow
Offline
Ameglian cow
Joined: Feb 2023
Posts: 43
Hello Khaled!
I'm using the last version 7.73 and the $wrap still got a little bug, it "eats" the first space character in this scenario:

pswecho {
var %wraptl = $wrap($2-,%fonte,%fonte.size,%window.size,p1t1w1,0)
var %wrapl = 0
while (%wrapl < %wraptl) {
inc %wrapl
echo $1 $pilaspace     $wrap($2-,%fonte,%fonte.size,%window.size,p1t1w1,%wrapl)
}
:end
}


then when I input:
pswecho $chan 0,1 ☠ 02,1102,11 teste 00,01 ☠ 

it "eats" the first space after 0,1
as you can see in the print:
[Linked Image from i.imgur.com]

when it supposed to shows like this:
[Linked Image from i.imgur.com]


please take a look whenever you can, i hope this is a easy fix

thank you

Joined: Feb 2023
Posts: 43
Ameglian cow
Offline
Ameglian cow
Joined: Feb 2023
Posts: 43
I just made a simple code so you can replicate the bug an easier way

Code
wraptest {
  var %test 2,11 test 
  echo -a %test
  echo -a $wrap(%test,Fixedsys,20,1000,p1t1w1,1)
}

Joined: Feb 2023
Posts: 43
Ameglian cow
Offline
Ameglian cow
Joined: Feb 2023
Posts: 43
I just found another bug on $wrap on v7.75, when the $wrap results in 4 or more lines, and a underline starts in 1st line and ends in 2nd line, then all lines will start with underline too.

code to replicate bug:

Code
alias testewrap { 
 var %bt.conferir = 1░▒▓1██2,0🖤12🖤11🖤71██71▓▒░59 GRÊMIO FOOT-BALL PORTO ALEGRENSE 77⭐96⭐53⭐71 IMORTAL TRICOLOR CAMPEÃO DE TUDO 77⭐96⭐53⭐ 59Lar de LUISITO SUÁREZ, El Pistolero! 71CAMPEÃO GAÚCHO 2023 3░▒▓3█4██8█8▓▒░ 71Próximo jogo 1░▒▓█59,0GRÊMIO71█▓▒░1⚽3░▒▓█1,3AMÉRICA3█▓▒░ 71Sábado 28/10 às 19h

  var %wraptl = $wrap(%bt.conferir,%fonte,%fonte.s,950,p1t1w1,0)
  var %wrapl = 0
  while (%wrapl < %wraptl) {
    inc %wrapl
    drawtext -p @preview $color(topic) %fonte %fonte.s 1 $calc((%fonte.s + 4) * (%wrapl + 1))     $wrap(%bt.conferir,%fonte,%fonte.s,950,p1t1w1,%wrapl)
  }
}

Joined: Dec 2002
Posts: 5,477
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,477
I tested your script and nothing happened. It looks like it needs a @ custom window and definitions for the font and font size variables. I extended the script to add these and could still not reproduce an issue.

Update: okay, after trying different font sizes/line widths, I am now able to reproduce the issue.

Last edited by Khaled; 20/11/23 01:15 PM.
Joined: Feb 2023
Posts: 43
Ameglian cow
Offline
Ameglian cow
Joined: Feb 2023
Posts: 43
sorry, i posted an incomplete testing alias, here the right code, but you already managed to reproduce it tho

Code
alias testewrap { 
  var %bt.conferir = 1░▒▓1██2,0🖤12🖤11🖤71██71▓▒░59 GRÊMIO FOOT-BALL PORTO ALEGRENSE 77⭐96⭐53⭐71 IMORTAL TRICOLOR CAMPEÃO DE TUDO 77⭐96⭐53⭐ 59Lar de LUISITO SUÁREZ, El Pistolero! 71CAMPEÃO GAÚCHO 2023 3░▒▓3█4██8█8▓▒░ 71Próximo jogo 1░▒▓█59,0GRÊMIO71█▓▒░1⚽3░▒▓█1,3AMÉRICA3█▓▒░ 71Sábado 28/10 às 19h

  window -p +fL @preview 0 0 1000 200
  drawfill @preview $color(background) $color(background) 0 0

  var %wraptl = $wrap(%bt.conferir,Consolas,20,950,p1t1w1,0)
  var %wrapl = 0
  while (%wrapl < %wraptl) {
    inc %wrapl
    drawtext -p @preview $color(topic) Consolas 20 1 $calc((20 + 4) * (%wrapl + 1))     $wrap(%bt.conferir,Consolas,20,950,p1t1w1,%wrapl)
  }
}

Joined: Feb 2023
Posts: 43
Ameglian cow
Offline
Ameglian cow
Joined: Feb 2023
Posts: 43
I'm testing now the new beta, seems like the underline bug was fixed!

Thank you Khaled 🙏

[Linked Image from cdn5.vectorstock.com]


Link Copied to Clipboard