Prevent tab discarding - google-chrome-extension

Is there a way prevent tab from discarding without reloading when used
chrome.tabs.discard(tabId);
?
I have 2 extensions, one that discards tabs and second that manages it's own single tab and I need second extension protect it's tab from being discarded.
My current work around is to listen on chrome.tabs.onReplaced event and reload the tab:
chrome.tabs.onReplaced.addListener((newTabId, oldTabId) =>
{
chrome.tabs.reload(newTabId);
});
But is there a way undiscard a tab without reloading it, or better yet prevent discard in the first place?

Related

What Is the Purpose of the tabclose Command In Vim?

If you have multiple tabs, giving the :tabclose command "closes" the tab but does not delete it from the buffer list, so the tab still appears in the tab menu; however it is inaccessible. To fully remove the tab, one would have to provide the :bd command. I'm not sure what the purpose is of closing a tab without deleting it from the buffer-list. From what I can gather from the help document, tabpage.txt, is that you aren't even able to reopen the closed tab, although, I could very well be wrong on that. I am rather confused on the purpose of this command; It seems more efficient to just use :bd and not bother with :tabclose.
:tabclose tries to close all windows on a tab. If it succeeds then the tab is also closed.
Buffer is neither tab nor window. :bdelete is neither :bunload nor :bwipeout. 1 2 3 4
If you have multiple tabs, giving the :tabclose command "closes" the tab but does not delete it from the buffer list, so the tab still appears in the tab menu; however it is inaccessible.
You are confusing tab pages, windows, and buffers.
:tabclose closes the tab page. This also closes the windows contained in that tab page but the only effect it has on the buffers displayed in those windows is to hide them.
What is remaining after :tabclose is the buffers that were displayed in the windows contained by the tab page you closed. Since the buffer list is global and not tied in any way to either tab pages or windows, this is perfectly normal and expected.
To fully remove the tab, one would have to provide the :bd command.
No. The tab page was fully removed after :tabclose. :bd only "deletes" buffers.
I'm not sure what the purpose is of closing a tab without deleting it from the buffer-list.
Your tab page is not in the buffer list so what you describe only makes sense if you confuse tab pages, windows, and buffers.
See this answer of mine for more background tab pages, windows, and buffers.

Do not show autocomplete popup when cycling through options in ST3

Sublime has built-in auto complete. It works fine, but I would really like to know how to disable autocomplete popup but still be able to cycle through completions using Tab with word under cursor changing right away?
You should be able to achieve this with a combination of two settings, shown here with the default values:
// When enabled, pressing tab will insert the best matching completion.
// When disabled, tab will only trigger snippets or insert a tab.
// Shift+tab can be used to insert an explicit tab when tab_completion is
// enabled.
"tab_completion": true,
// Enable auto complete to be triggered automatically when typing.
"auto_complete": true,
auto_complete controls whether the autocomplete popup appears automatically or not, so setting that preference to false in your user preferences will stop the popup from appearing unless you manually cause it to appear with the appropriate key binding (the default is Alt+/ on Linux and Ctrl+Space everywhere else).
Regardless of the value of that setting, if tab_completion is set to true (which it is by default) then that command will try to insert the best matching completion at current cursor location, and as long as you don't move the cursor or take any other actions you can continue to press Tab to cycle between all of the available completions.

Using ncurses - trying to understand wgetch()

I created a single-window menu scheme using ncurses and got it working.
When I added a second window, I can no longer get my wgetch call to fire (or so it seems).
Somewhat confusing to me is the function prototype :
int wgetch(WINDOW *win);
which says wgetch somehow depends on the window but I don't get the relationship - how does "the window" matter? If it does, and I have more than one window, which one do I use? Also, https://linux.die.net/man/3/wgetch says "There is just one input queue for all windows." which tells me "the window" is a "don't care".
Can someone explain?
Thanks.
The window matters because wgetch refreshes the window before reading characters. That's in the wgetch manual page:
If the window is not a pad, and it has been moved or modified since the
last call to wrefresh, wrefresh will be called before another character
is read.
Each window (including stdscr) may have been altered since the last call to wrefresh. If you make changes in one window without refreshing it, and then call wgetch in another window, the changes to the first window are not automatically displayed. You can use wnoutrefresh to combine refreshes, e.g., using that for the first window and then use the wrefresh done automatically for the second window to refresh both.

SublimeText3: How to do the the opposite of `focus_side_bar`, i.e. focus the main view?

I have a command in a sublime plugin
v.window().run_command("reveal_in_side_bar")
v.window().run_command("focus_side_bar")
that focuses the sidebar. And in another command I hide the side bar (by toggle_side_bar) but the focus still remains on the (now hidden) sidebar.
How to switch the focus back to the main view (the file contents)?
sublime.Window has several methods that could be useful, including focus_view(view), active_view(), focus_group(group), and active_group(). You can save the current view with active_view(), run your reveal_in_side_bar and focus_side_bar commands, then switch back to the formerly active view with focus_view(). Or, if you only have one group in your window, focus_group(0) will switch back to it. If there are multiple groups, use active_group() to get its index.
Press Escape key while in the side-bar would return you to the main edit

How to keep autocomplete event active on Xpages

I've an xpages in which i set some fields to filter documents, with an autocomplete in one of these.
At the end, a button make a pdf based on this query fields (onClick action), and the pdf is presented to be saved or open.
Ad this point, autocomplete doesn't work anymore, i need to reload the xpage to make autocomplete active again, but i loose all other field values set in previous search.
Is it possible to keep autocomplete alive?
My guess is that you serve up an PDF directly from the page and no in a separate window. This will make the XPage to stall and will wait for a timeout of some kind.
I usually on the pdf generation button add this on a js timeout.
XSP.allowSubmit()
That usually works in the cases I have encountered.
Problem solved!
Just set the type ahead mode to Partial instead of Full
Thanks everyone

Resources