[PATCH v2 1/6] kernelbase/console, programs/conhost: support CONSOLE_READCONSOLE_CONTROL in ReadConsoleW

Eric Pouech eric.pouech at orange.fr
Sun Feb 27 08:02:29 CST 2022


Le 25/02/2022 à 20:10, Jacek Caban a écrit :
> Hi Eric,
>
> The series looks mostly good for me.
>
> On 2/23/22 18:05, Eric Pouech wrote:
>> +    if (initial_len && edit_line_grow( console, initial_len + 1 ))
>> +    {
>> +        unsigned offset = edit_line_string_width( initial, 
>> initial_len );
>> +        if (offset > ctx->home_x)
>> +        {
>> +            int deltay;
>> +            offset -= ctx->home_x;
>> +            deltay = offset / console->active->width;
>> +            ctx->home_y = (deltay >= ctx->home_y) ? ctx->home_y - 
>> deltay : 0;
>
>
> Isn't the logic reverted here?
yes
>
>
>> +            ctx->home_x = console->active->width - 1 - (offset % 
>> console->active->width);
>
>
> I wonder if we should use use 0 for home_x in case of deltay >= home_y.

actually, this was more to protect the rest of the code which isn't 
prepared for negative coordinates

IIRC I tested this UC and native supports this

changing the code for handling such case is not immediate, but I thought 
that the ratio real value vs effort was near 0 and not worth for now 
going for it

so we could either add a FIXME (and leave the 0) or add a FIXME and 
return an error

A+





More information about the wine-devel mailing list