Project

General

Profile

Bug #1733

Inconsistent trimming of whitespace from IRC lines

Added by bakerst 3 months ago. Updated 10 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Quassel Core
Target version:
-
Start date:
06/25/2021
Due date:
% Done:

0%

Estimated time:
Version:
0.13.1
OS:
Any

Description

This issue was noticed through a Solanum help file that contained a trailing space.

When a line received from IRC contains a trailing space, leading spaces are removed from the lines too. If there is no trailing space, leading spaces are kept intact. In this particular instance, this resulted in the incorrect rendering of the output of server-side help (the indentation is broken in the line containing "+u"):

 09:05:37 * 705 umode      USERMODE     DESCRIPTION
 09:05:37 * 705 umode -----------------------------------------------------------------
 09:05:37 * 705 umode          +o     - Designates this client is an IRC Operator.
 09:05:37 * 705 umode                   Use the /oper command to attain this.
 09:05:37 * 705 umode          +i     - Designates this client 'invisible'.
 09:05:37 * 705 umode        ? +h     - Has a cloaked host. May be +x depending on cloaking module
 09:05:37 * 705 umode          +g     - Deny users not on your /ACCEPT list from messaging you and
 09:05:37 * 705 umode                   inviting you to channels.
 09:05:37 * 705 umode ? +u     - Receive messages that are filtered server side based
 09:05:37 * 705 umode                   on content.
 09:05:37 * 705 umode          +w     - Can see oper wallops.

This issue is caused by the following code from src/core/ircparser.cpp

if (!decParams.isEmpty() && decParams.last().endsWith(' '))
    decParams.append(decParams.takeLast().trimmed());

The inconsistency is that the code checks for endsWith but then uses trimmed to remove the whitespace. QString::trimmed removes whitespace from both ends of the string. In my opinion, only whitespace at the end of the line should be removed if the condition holds. An alternative solution could be to exempt lines for server help numerics from trimming.

History

#1 Updated by phuzion 3 months ago

  • Category set to Quassel Core

#2 Updated by Delancey598 about 2 months ago

If your editor can do it based on the rules of the language and not just “remove it from any line” then it’s fine. Otherwise there’s certain situations where it may matter. If you never write such things (multiline string literals etc) then you can also use a dirty “remove all white space from lines” if you want.

Also available in: Atom PDF