public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dave Page <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][Patch]: RM #1807 Query Tool Does Not Recognize When File Changes Have Been Saved
Date: Fri, 16 Dec 2016 12:58:22 +0000
Message-ID: <CA+OCxoyo9RTn=5R7mTueq65sk=TN49DYucGAb2FdYj3qvx5tdA@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDcPAPga6nuhMUZ-cYrcsidmko7_OP+kVfgPVRmK-dpxiA@mail.gmail.com>
References: <CANxoLDeuyz5d1+kKmpXiSdDMmtRGnKV+6dNmvtHeBTPjw6XV3w@mail.gmail.com>
	<CA+OCxoye7d0F8dt8UKAQan2b+fzVB=v919=MTkwVZ4R-wx3Hug@mail.gmail.com>
	<CANxoLDcPAPga6nuhMUZ-cYrcsidmko7_OP+kVfgPVRmK-dpxiA@mail.gmail.com>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi

On Fri, Dec 16, 2016 at 12:46 PM, Akshay Joshi <
[email protected]> wrote:

> Hi Dave
>
> On Fri, Dec 16, 2016 at 5:22 PM, Dave Page <[email protected]> wrote:
>
>> Hi
>>
>> On Fri, Dec 16, 2016 at 8:47 AM, Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi All
>>>
>>> Please find the attached patch to fix the RM #1807 Query Tool Does Not
>>> Recognize When File Changes Have Been Saved.
>>>
>>
>> If I open a file with the patch applied, and make a change (add a space
>> to the end), it's correctly detected.
>>
>> If I then undo the change by deleting the space, the file is still marked
>> as dirty.
>>
>
>    This was an old behaviour. To achieve this we need to compare the
> original content with changed content on each key press event.
>

OK, but it's inconsistent with what happens if I'm not working with a file
- in that case if I add a character and then remove it (so the query is
empty again), then it does mark the editor as clean again.

If you look at pgAdmin III, then any change to either an opened file, or a
blank editor will mark it dirty. It never marks it as clean again. That
means no content comparison, and consistent behaviour.



>
>> If I then clear the window entirely, the save button is disabled, but the
>> tab still shows the file is dirty (the *).
>>
>
>    Again this was an old behaviour, I have added only one if condition to
> check whether to popped up "Unsaved Changes" message or not.
>

Maybe - but the point is to fix the old behaviour :-). The dirty marker and
enabled/disabled state of the save option should be in sync shouldn't they?
I shouldn't expect to see a file marked as dirty that I cannot save (even
if it is empty).


>
>> Also - the patch seems to undo the change I made
>> in 4a280b251755091af9bf56bcdee964601df104ae.
>>
>
>     As per commit id 4a280b251755091af9bf56bcdee964601df104ae, you have
> made following changes:
>
> -                self.setTitle(self.gridView.current_file.
> replace(/^\/|\/$/g, ''));
> +                self.setTitle(self.gridView.current_file.
> split('\\').pop().split('/').pop());
>
> And as per me I haven't change any thing there, I have only disabled the
> save button when file is loaded which was not there previously.
>

Ahh, no - I see the issue. When the file is marked as dirty, it uses the
full path again. Can you fix that to use just the filename please?

Thanks.

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [pgAdmin4][Patch]: RM #1807 Query Tool Does Not Recognize When File Changes Have Been Saved
  In-Reply-To: <CA+OCxoyo9RTn=5R7mTueq65sk=TN49DYucGAb2FdYj3qvx5tdA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox