I managed to sort it out.

This code retrieves the lines from the editbox history, keeping the spaces. It works with both editboxes, and it works when multiple lines are being pasted at once.

It should theoretically always find it's result, but in the cases where it doesn't, it still has the space tokenized input.

Code:
on *:input:#: {
  if !$ctrlenter {

    ;If there is already a input queue for this window, simply add one additional line.
    if $hget(input, lines) {
      haltdef
      hinc input lines 1
      hadd input $+(line, $hget(input, lines)) $1-
    }

    ;If the primary editbox is empty, recall the last line for the primary editbox.
    elseif $editbox($active) == $null {
      haltdef
      hinc input lines 1
      hadd input $+(line, $hget(input, lines)) $1-
      editbox -afn /
      .timergrabinput 1 0 grabinput 1
    }

    ;If the primary editbox is not empty, but the secondary editbox is, recall the last line for the secondary editbox.
    elseif $editbox($active, 1) == $null {
      haltdef
      hinc input lines 1
      hadd input $+(line, $hget(input, lines)) $1-
      editbox -afno /
      .timergrabinput 1 0 grabinput
    }

    ;Catch the error in case the secondary editbox is unavailable.
    :error
    reseterror
  }
}

;Grab the input entries.
alias -l grabinput {

  ;Compare the value with a tokenized version of the editbox, to see if they match.
  if $1 {
    tokenize 32 $editbox($active)
    if $hget(input, $+(line, $hget(input, lines))) == $1- {
      hadd input $+(line, $hget(input, lines)) $hardspace($editbox($active))
      hdec input lines 1

      ;If there are more lines in queue, request the next editbox line.
      if $hget(input, lines) {
        editbox -afn /
        .timergrabinput 1 0 grabinput 1
        return
      }

      ;Clear the editbox.
      editbox -a
    }
    else {
      editbox -a

      ;If the primary editbox does not match, but the secondary editbox is empty, recall the last line for the secondary editbox.
      if $editbox($active, 1) == $null {
        editbox -afno /
        .timergrabinput 1 0 grabinput
        return
      }
    }
  }
  else {
    tokenize 32 $editbox($active, 1)
    if $hget(input, $+(line, $hget(input, lines))) == $1- {
      hadd input $+(line, $hget(input, lines)) $hardspace($editbox($active, 1))
      hdec input lines 1

      ;If there are more lines in queue, request the next editbox line.
      if $hget(input, lines) {
        editbox -afno /
        .timergrabinput 1 0 grabinput
        return
      }
    }

    ;If the result does not match, and the first editbox is empty, return the focus to the first editbox.
    elseif $editbox($active) == $null {
      editbox -af
    }

    ;Clear the editbox.
    editbox -ao
  }

  ;Catch the error in case the secondary editbox is unavailable.
  :error
  reseterror
  hdel input lines
  evalinput
}

;Evaluate the input entries.
alias -l evalinput {
  var %count 1
  while $hget(input, $+(line, %count)) != $null {
    tokenize 32 $hget(input, $+(line, %count))

    ;If the first parameter does not start with /, say the line in the channel.
    if $left($remove($1, $chr(160)), 1) != / && $left($remove($1, $chr(160)), 1) != $readini($mircini,text,commandchar) {
      say $1-
    }

    ;If the first parameter equals /me, emote the remaining line in the channel.
    elseif $right($remove($1, $chr(160)), -1) == me {
      me $2-
    }

    ;Remove the $chr(160) signs and execute the line.
    else {
      $remove($1-, $chr(160))
      ;Include an errorcatcher, to allow further lines to execute.
      :error
    }
    hdel input $+(line, %count)
    var %count $calc(%count + 1)
  }
}

alias -l hardspace return $replace($+($chr(32), $1-), $+($chr(32), $chr(32)), $+($chr(32), $chr(160)), $+($chr(160), $chr(32)), $+($chr(160), $chr(160)))


Note: While it can pick up adjacent spaces, it of course cannot actually send these out, so the code replaces the spaces by non breaking spaces. All leading spaces, and all spaces but the first in a group of spaces are being converted, keeping the parameters 1:1 with what they would be in a tokenized version, so the end result is something like:

Code:
   word1   word2   word3   
___word1 __word2 __word3 __

Last edited by Thels; 29/08/10 10:58 PM.

Learning something new every day.