Re: [pgAdmin4][Patch]: To fix Indentation issue in query tool

From: Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][Patch]: To fix Indentation issue in query tool
Date: 2017-10-16 12:56:32
Message-ID: CAKKotZS2kx67KkESyQrQcD6tBcuOymGuR9+H_Z6ZZ7eEK0Q3Lw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Dave,

Please find updated patch.

On Mon, Oct 16, 2017 at 5:56 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> Hi
>
> On Mon, Oct 16, 2017 at 1:21 PM, Murtuza Zabuawala <
> murtuza(dot)zabuawala(at)enterprisedb(dot)com> wrote:
>
>> Sorry, that was a typo in 'sqleditor/__init__.py'.
>>
>> I have updated the patch, We require this option because by default
>> codemirror indent the code with spaces.
>>
>> Steps to re-produce (without patch):
>> 1) With preference option
>> Use spaces? = False
>> Tab size = 4
>>
>> 2) Open query tool
>> - Press Tabs key 3-4 times & type select 1; <enter>
>> - Observe the new line indentation using right arrow key. (Attaching
>> screenshot)
>>
>> This patch allow us to use Tab key as indentation.
>>
>> Now apply the patch set the option Use tabs for indentation? to true and
>> check the same behaviour.
>>
>
> I understand the problem, but what I don't understand is why we need a new
> option for it, given that we already have use_spaces.
>
> I can't think of any reason why you would want the two settings to have
> different values... therefore, why not have just one setting that is
> honoured whether the indent is the result of the user pressing the tab key,
> or an auto-indent following an end of line?
>
>>
>>
>> On Mon, Oct 16, 2017 at 2:14 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>
>>> Hi
>>>
>>> On Mon, Oct 16, 2017 at 5:43 AM, Murtuza Zabuawala <
>>> murtuza(dot)zabuawala(at)enterprisedb(dot)com> wrote:
>>>
>>>> Hi,
>>>>
>>>> PFA patch to fix the issue where indentation is not working as
>>>> expected, when user opt for tab based indentation instead of space based
>>>> indentation.
>>>> RM#2780
>>>>
>>>
>>> Shouldn't we just use the use_spaces option here? I don't see any reason
>>> why pressing tab vs. an auto-indent should be any different.
>>>
>>> As a sidenote, in sqleditor/__init__.py, both config options are being
>>> defined as "self.use_spaces = ..."
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

Attachment Content-Type Size
RM_2780_v2.diff text/plain 11.7 KB

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Murtuza Zabuawala 2017-10-16 14:19:03 [pgAdmin4][Patch]: Fix naming convention for Check constraint.
Previous Message Dave Page 2017-10-16 12:26:03 Re: [pgAdmin4][Patch]: To fix Indentation issue in query tool