Re: [code] [textadept] Menu modification delay 2

From: Gabriel Dubatti <gdubatti.att.gmail.com>
Date: Mon, 14 Nov 2016 21:45:56 -0300

Hi Mitchell,

     I downloaded and installed the nightly build. Also compared
menu.lua with mine and they were the same.

----
     I don't know why but some menubar modifications did work and some 
did not.
     So I rewrote the code to replace the complete menu bar at 
initialization time with just one line:   textadept.menu.menubar= 
proj_menubar,  this part now works fine.
----
     When I try to change the tab context menu with:
       local menu= textadept.menu.tab_context_menu
       table.insert(menu,2,{'Close Others', Proj.close_others})
       table.insert(menu,3,{"Mark as don't close", Proj.keep_thisbuffer})
       table.insert(menu,4,{_L['Close All'], Proj.onlykeep_projopen})
     These items don't appear.
-----
     Also, when I try to modify the context menu (when the buffer 
changes) with:
        1) at init time I get the sub-menu position with: 
Proj.cmenu_idx= #textadept.menu.context_menu +1
        2) every time I want to change the project context submenu, I 
set it with:
             textadept.menu.context_menu[ Proj.cmenu_idx ]= {
               title='Project',
               {'_End edit',   Proj.change_proj_ed_mode}
             }
     This sub-menu doesn't appear.
----
     If I replace: "if not type(v) == 'function' then update(menubar or 
menu) end" with   "update(menubar or menu)", all works fine.
----
     Let me know if you need more information or tests.
     Cheers,
     Gabriel
El 14/11/16 a las 20:16, Mitchell escribió:
> Hi Gabriel,
>
> On Sat, 12 Nov 2016, Gabriel Dubatti wrote:
>
>> Hi Mitchell,
>>
>>    When I tried this change at home I noticed that all my 
>> modifications in the menus are missing:
>>
>>    1) adding a new item to the menu bar:
>>
>>            textadept.menu.menubar[ #textadept.menu.menubar+1 ]= {...}
>>
>>    2) modifying the edit menu:
>>
>>            local med=textadept.menu.menubar[_L['_Edit']]
>>            med[#med+1]= {''}
>>            med[#med+1]= {'Trim trailing spaces', 
>> Proj.trim_trailing_spaces}
>>
>>    3) the context menu:
>>
>>            textadept.menu.context_menu[ 
>> #textadept.menu.context_menu+1 ]= {...}
>>
>>    4) and the tab context menu:
>>
>>            local menu= textadept.menu.tab_context_menu
>>            insert_menu(menu,2,{'Close Others', Proj.close_others})
>
> That is odd. When I do 1, 2, and 3, I get the expected results. I 
> cannot do 4 because I don't have your `insert_menu()` function.
>
> Does your home machine have Textadept 9 on it? Regardless, it sounds 
> like a copy-paste problem or something else in your 
> ~/.textadept/init.lua that is not present on your non-home computer. 
> Try downloading a nightly build and see if it works.
>
> Cheers,
> Mitchell
-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Mon 14 Nov 2016 - 19:45:56 EST

This archive was generated by hypermail 2.2.0 : Tue 15 Nov 2016 - 06:52:27 EST