emacs: x-popup-menu max size constraints? - emacs

I'm working on an intellisense or code-completion capability for C#.
So far, so good. Right now I have basic completion working. There are 2 ways to request completion. The first cycles through all the potential matches. The second presents a popup menu of the matches. It works for types:
And also for local and instance variables:
I'm confronting two problems with x-popup-menu:
the popup menu can expand to consume all available screen space, when the number of choices is large. Literally it can consume the entire screen, and obscure everything else, including the entire emacs window and every other window.
The silly thing is, it's scrollable. First it expands to consume all available space, then it also becomes scrollable. Seems like it would make sense for it to expand to a certain point, and then become scrollable, rather than expanding to take all available space.
Is there a way I can limit the maximum size of x-popup-menu?
To specify the position of the popup menu, I pass in a position, and x-popup-menu uses that as the *middle*, not the left, of the top line of the menu. Why middle? who knows.
What this means is, if I specify (40 . 60) for the location of the menu, and the menu happens to be 100 pixels wide, the menu will extend beyond the left border of the emacs window. You can see this in the 2nd image above.
If I knew how wide the popup would be before specifying the position, I could compensate. But I don't.
Is there a workaround? Is there a way to get x-popup-menu to take its position as the LEFT rather than the middle?
Addendum: Doc for x-popup-menu
x-popup-menu is a built-in function in `C source code'.
(x-popup-menu POSITION MENU)
Pop up a deck-of-cards menu and return user's selection.
PO SITION is a position specification. This is either a mouse button
event or a list ((XOFFSET YOFFSET) WINDOW) where XOFFSET and YOFFSET
are positions in pixels from the top left corner of WINDOW's frame
(WINDOW may be a frame object instead of a window). This controls the
position of the center of the first line in the first pane of the
menu, not the top left of the menu as a whole. If POSITION is t, it
means to use the current mouse position.

Some people like Emacs because it doesn't provide popup windows (see e.g. this blog entry). The more "emacsy" way of presenting your list of possible completions is to show them in a split buffer. That way you would automatically avoid all of the above issues (screen real estate & scrolling) and would probably attract more of the die-hard Emacs users.
But that's pure speculation :-)

You can base your autocompletion backend on company or autocomplete where display of suggestions is handled for you.

Related

Is there a shortcut to switch between panes in the Eclipse Compare view?

When I compare two versions of a source file (for example, from egit) in the Eclipse IDE, the Compare View is appeared. It has two panes containing two versions of a text and I can use keyboard to move cursor through the text on one of this panes (or even edit the text in it). Additionally, I can use special shortcuts to go to the next/previous difference and/or apply current change from/to the opposite pane. But, I didn't find a way to move the input focus to other pane.
Actually, I would like be able to do this in one case. Let's say, I compare two revisions of a source and I need to apply some changes while others are unneeded. To achieve this, I walk through changes using the Ctrl + , or . shortcuts and apply needed changes using, for example, the Ctrl + Shift + ,. It looks like all is OK, but if I reach a change which has no any text in the current pane, the applying shortcut does not work. For example, the cursor is on the left pane. I went to the next difference and this difference is concluded in that the text was, for example, added in this line. So, the Compare View will show this added text on the right pane, will highlight it with the special rectangle while this rectangle on the left pane will have zero height and the cursor will be placed under this zero-sized rectangle. I.e., outside of it. So, I think, exactly this thing causes that the current change applying does not work. When I click on the opposite pane, inside of this change and then use the change applying shortcut, it works fine. So, I would like to switch to other plane via shortcut, not using mouse.

In VS Code can I change the width of the split editor panel with a shortcut or command?

In VS Code When I have a vertical editor split with 2 panels I would like to be able to change the right panel's width to a predefined total window width % using a shortcut.
Say I would like to have one shortcut to show the right panel at 50% of the overall VSC width. Then the second shortcut is 30%, the third is 80% and the 4th is 0%.
At the same time I would not like to have any files from the right editor panel joined or closed when I change the panel's width.
Is it posssible with the built-in commands of extensions?
I discovered the VS Code behavior that partially resembles the feature I described above.
To see this we have to split the editor in 2 panels (View->Editor Layout->Two Columns), open some file in the right hand one, manually move its border to the farthest right. Then as we switch between the panels with Ctrl-1 and Ctrl-2 (Windows) the respective active panel will restore its maximum width and the other will get the minimum width.
This does not fully solve my problem but at least alleviates the pain.

Stop Layout Options icon appearing by default on callouts in Word 2013

This is driving me mad! I love the new layout options in Word 2013, but when a callout gets to a certain size the icon for it obscures the end of the arrow, and you can't move the arrow:
Don't suppose anyone knows either how to get rid of the icon, how to click and drag on the yellow end of the arrow, or how to stop the icon appearing in the first place?
Thanks in advance.
Here are two answers that helped me. The second option gets rid of the floating Layout Options button, but at the cost of disabling some features of Word 2013.
First Option:
http://answers.microsoft.com/en-us/office/forum/office_2013_release-word/any-way-to-disable-the-layout-options-button/47f6af4a-2acd-483e-a953-6415c8530554
It might help to increase the zoom (use the slider at the right end of the status bar) while you work with the picture.
Second Option:
http://answers.microsoft.com/en-us/office/forum/office_2013_release-word/layout-options-icon-word-2013-suddenly-missing/ce304589-9db2-44c5-b1e1-8fd6596b70c4
Is the document in Compatibility Mode (shown by those words appearing in the title bar along with the document name)? If that's the case, click File and then click the Convert button. That will make the Layout Options button appear when a picture is selected, as well as turning on other features that are available only in the 2013 format. When you save, the document file will change to the .docx extension.
I know the second quote is about turning the Layout Options button on, but it works backwards, too. I saved my file as a *.doc instead of a *.docx and the floating button went away.
When you're finished editing your callouts, you can save it again as a *.docx.
One method that helped me was to flip horizontal, change the leader position, then flip back. That way the leader line is temporarily on the opposite side of the layout button, and both handles of the leader line are accessible, then can flip back. It is an extra step, but is another alternative.
In an attempt to automate this to quickly flip the object back and forth, I couldn't find a macro command to make a shortcut, or anything under Customize Ribbon with custom Keyboard Shortcuts to Flip Horizontal (MoreRotationOption opens up a dialog which does not give an option to flip).
The Flip Horizontal command could be called by pressing ALT JD (Format) AY (Rotate Objects) H (Horizontal) when the object is selected...
The best I could do was to add Rotate Objects to the Quick Access Toolbar, then the Flip Horizontal command could be called by pressing ALT # (whatever number you assign) H (Horizontal) which is three keystrokes.

Split windows in Netbeans

I'm trying to split my windows so I can have 2 different classes or whatever on 1 screen but it will only split the window of the same class/file/whatever. I've been using netbeans for years and still can't do this.
Is this possible?
You don't specifically mention which version of NetBeans you are using. I'm using version 8, and these instructions work for that version and version 7. I believe it is the same for version 6.
If you want to see two different source files on the screen at the same time (without floating), then open both source files. You will have two tabs in the editing area of the IDE. Click on the tab of one of the source files without releasing the mouse button (and without holding any additional keys), and drag toward either the right side of the editing area, or toward the bottom of the editing area (depending on whether you want them side-by-side or stacked). You will see an orange outline appear once you start dragging. If the orange box encloses the entire editing area, then the IDE thinks you want to reorder the tab. Keep dragging toward the edge (without going over) and eventually you will see the orange box change to fill either the right half or the lower half (or if you drag the other way, the left half or the top half) of the editing area. Releasing the mouse button at this point will drop the source file in that half of the editing area, leaving you with the two source files side-by-side or stacked.
Here's an example of what it looks like when stacking two source files, just before the mouse button is released:
And here is what it looks like after releasing the mouse button:
If you want to have the same source file duplicated on the screen, open the single source file and follow the instructions above, only hold the CTRL key while clicking-and-dragging.
You can repeat this procedure as many times as you want (as is practical for your screen size), so that you end up with source files in several columns, several rows, or any combination thereof.
When you next open a file, it will be opened in the tab group of the currently selected source file. If you end up with a source file opened in the "wrong" tab group, just drag it to where you want it using the procedure above (allowing the orange box to outline the whole tab group area if you want to drop it in as a tab).
Additional screen shots for reference...
Reordering a tab within the same tab group:
Side-By-Side instead of stacked (two images):
Get as crazy as you want...
Create the above by dragging the second file to the lower half, the third file to the right half of the top half, and the fourth file to the right half of the lower half.
At least in netbeans version 8.1, you can ctrl + i and write "move window".
This will allow you to move the window with the arrows, it is the same as some user posted before but using the keyboard instead of the mouse (I prefer keyboard for this kind of things while I am coding).

GTK window hints

I'm trying to get a window to cover the whole screen. Its positioning and dimensions is fine but it gets covered by the Gnome panel. To complicate things I have two monitors and this app needs to support people with multiple screens.
WINDOW_TYPE_HINT_SPLASHSCREEN is a good start. It covers both screens but not the panel. It's still there, just behind the panel.
WINDOW_TYPE_HINT_DOCK looked ideal but I need this window to take focus to listen to a keyboard event. _DOCK seems like it purposely ignores keyboard events (which kind of makes sense). Can I force it to take keyboard focus?
Is there some way I can force a hinted window to cover the panel?
There's window.fullscreen() which you can call on a normal "un-hinted" window. I assume this lets the window manager decide whether the window should cover the panel or not.
If you use the WINDOW_TYPE_HINT_MENU, you can give the focus to the window by calling the gtk_window_present() function.
However, I don't know if you will be able to cover the panel.
Another hint: the panel probably change its _NET_WM_STRUT property so that other windows cannot cover it. Maybe you will have to play with this property (or another) in your window.