[Padre-dev] [Padre] #85: fix a bug (open many window for 1 file)
Fayland Lam
fayland at gmail.com
Sat Nov 1 03:12:02 PDT 2008
I'm afraid I need know more Wx. never learn that before.
I'll submit again once I get it work.
Thanks.
2008/11/1 Gabor Szabo <szabgab at gmail.com>:
> I am diverting this to the mailing list as I saw you have also subscribed.
>
> I don't want to silently reload the file from the disk.
> We should give a warning and let the user decide if he wants to reload or not.
>
> Actually I think even the "jump to the currently opened buffer" when trying
> to open an already opened file should tell the user what happened.
> Maybe by a pop-up. or just on the status bar?
>
> Gabor
>
> 2008/11/1 Fayland Lam <fayland at gmail.com>:
>> Gabor Szabo wrote:
>>>
>>> thanks, applied.
>>>
>>> Gabor
>>>
>>
>> another patch: when user tries to open an opened file, reload doc if it's
>> changed.
>>
>> hmm, the sub name may not satisfy you, please rename it as u like.
>> and if you prefers File::Modified than -M, I'll submit another patch with
>> "File::Modified". but I think -M is enough.
>>
>> Thanks.
>>
>>> On Fri, Oct 31, 2008 at 3:04 PM, Fayland Lam <fayland at gmail.com> wrote:
>>>
>>>>
>>>> OK. here you are. I hope I'm not making a mistake. but that's pretty
>>>> simple.
>>>>
>>>> Thanks.
>>>>
>>>> On Fri, Oct 31, 2008 at 8:57 PM, Gabor Szabo <szabgab at gmail.com> wrote:
>>>>
>>>>>
>>>>> On Fri, Oct 31, 2008 at 2:56 PM, Fayland Lam <fayland at gmail.com> wrote:
>>>>>
>>>>>>
>>>>>> hi, since I can't reopen it, I'm saying here. hope you don't mind.
>>>>>>
>>>>>> "but I think just focus on that tab instead of an error is better."
>>>>>>
>>>>>
>>>>> I'd appreciate a patch against svn for that
>>>>> Gabor
>>>>>
>>>>>
>>>>>>
>>>>>> anyway, good job. man
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> On Fri, Oct 31, 2008 at 8:49 PM, Padre <trac at perlide.org> wrote:
>>>>>>
>>>>>>>
>>>>>>> #85: fix a bug (open many window for 1 file)
>>>>>>>
>>>>>>> ----------------------+-----------------------------------------------------
>>>>>>> Reporter: fayland | Owner:
>>>>>>> Type: defect | Status: closed
>>>>>>> Priority: major | Milestone:
>>>>>>> Component: editor | Version: 0.14
>>>>>>> Resolution: fixed | Keywords:
>>>>>>>
>>>>>>> ----------------------+-----------------------------------------------------
>>>>>>> Changes (by fayland):
>>>>>>>
>>>>>>> * status: new => closed
>>>>>>> * resolution: => fixed
>>>>>>>
>>>>>>>
>>>>>>> Comment:
>>>>>>>
>>>>>>> oh, thanks. I'm a bit outdated
>>>>>>>
>>>>>>> --
>>>>>>> Ticket URL: <http://padre.perlide.org/ticket/85#comment:2>
>>>>>>> Padre <http://padre.perlide.org/>
>>>>>>> Perl Application Development and Refactoring Environment
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Fayland Lam // http://www.fayland.org/
>>>>>> Foorum based on Catalyst // http://www.foorumbbs.com/
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Gabor Szabo http://szabgab.com/blog.html
>>>>> Perl Training in Israel http://www.pti.co.il/
>>>>> Test Automation Tips http://szabgab.com/test_automation_tips.html
>>>>> Phones: +972-8-975-2897 +972-54-4624648
>>>>>
>>>>>
>>>>
>>>> --
>>>> Fayland Lam // http://www.fayland.org/
>>>> Foorum based on Catalyst // http://www.foorumbbs.com/
>>>>
>>>>
>>>
>>>
>>
>>
>> --
>> Fayland Lam // http://www.fayland.org/ Foorum based on Catalyst //
>> http://www.foorumbbs.com/
>>
>> Index: lib/Padre/Document.pm
>> ===================================================================
>> --- lib/Padre/Document.pm (版本 626)
>> +++ lib/Padre/Document.pm (工作副本)
>> @@ -255,6 +255,8 @@
>> sub load_file {
>> my ($self, $file, $editor) = @_;
>>
>> + $self->{last_load_time} = -M $file;
>> +
>> my $newline_type = $self->_get_default_newline_type;
>> my $convert_to;
>> my $content = eval { File::Slurp::read_file($file, binmode => ':raw')
>> };
>> @@ -332,6 +334,14 @@
>> $_[0]->{filename} = $_[1];
>> }
>>
>> +sub get_last_load_mtime {
>> + $_[0]->{last_load_mtime};
>> +}
>> +
>> +sub get_last_modify_mtime {
>> + return -M $_[0]->filename;
>> +}
>> +
>> sub mimetype {
>> $_[0]->{mimetype};
>> }
>> Index: lib/Padre/Wx/MainWindow.pm
>> ===================================================================
>> --- lib/Padre/Wx/MainWindow.pm (版本 626)
>> +++ lib/Padre/Wx/MainWindow.pm (工作副本)
>> @@ -777,6 +777,11 @@
>> my $id = $self->find_editor_of_file($file);
>> if (defined $id) {
>> $self->on_nth_pane($id);
>> + # reload if it's changed.
>> + my $doc = Padre::Documents->by_id($id);
>> + if ( $doc->get_last_modify_mtime <
>> $doc->get_last_load_mtime ) {
>> + $doc->reload;
>> + }
>> return;
>> }
>> }
>>
>>
>
--
Fayland Lam // http://www.fayland.org/
Foorum based on Catalyst // http://www.foorumbbs.com/
More information about the Padre-dev
mailing list