In Spacemacs with the Clojure layer, if I do SPC m h h, it splits the window with documentation information, and moves the cursor to the new split containing the docs.
Is there a keyboard shortcut that will move the cursor back to the top split that contains the code? The typical vim shortcut I use, C-w k, doesn't work when the cursor is in the doc split.
Most often, I just read the documentation and press q to close documentation window.
If you're using evil mode it's also quite easy to move back with SPC <window_number>; for me most often SPC 1.
In emacs mode, C-x o can work too, but it depends on how many windows you have.
Related
Many other IDEs have a feature to run the code block your cursor is placed in. According to the docs, SAS EG has the following shortcut:
Run the selected code -> F3
But is there a shortcut for the following?
Run code block your cursor is placed in -> X
It's tedious to have to constantly reach for the mouse to click-drag-select, then hit F3.
Preemptive thank you from the laziest lizard on earth.
No, there is no shortcut (or way to create such a shortcut). SAS requires you to highlight it.
However, there are some options to make this easier. You can see the SAS EG documentation for some keyboard shortcuts; one option, for example, is to use code folding (Alt + numeric keypad hyphen) to collapse the current data step/proc step/macro, and then you can easily highlight that one line (with shift-end, as it places your cursor at the start of the line).
Also see this question and answer about SAS Enhanced Editor, which has the same basic solution, plus some other ideas.
I find myself using BBEdit on a mac a lot during development (and pure text editing as well). It's great and fulfills pretty much all of my needs. However one really annoying thing I find with it is that the Find dialog closes automatically after the first match is found. What I would much rather see is the dialog staying up with the "find" button highlighted, so that I could keep pressing "enter", "enter", "enter"... to get to the next, next, next... match. Yet I'm force to press 'cmd-F' after every match to re-open the dialog.
Is there any way to change this behaviour?
Press CMDg for next and CMDSHIFTg for previous match then the window will not close.
I want to take over the console like less does, to make a more interactive app. It seems like they have complete control over what gets drawn where. How can I do that?
It uses the ncurses library for handling the terminal.
Primarily, less and other full-screen terminal applications use the alternate screen mode; otherwise known as DEC mode 1049. terminfo stores the strings needed to enter/exit this mode in
enter_ca_mode=\E[?1049h
exit_ca_mode=\E[?1049l
Once you enter alternate screen mode, you get full control of the screen by the usual escape sequences, drawing to an entirely separate "buffer" on most terminals, that leaves the regular buffer (such as may contain the bash scrollback) unaffected. When you leave alternate screen mode again it restores the previous contents and cursor state.
Look up 'curses' in your system's documentation.
The ANSI escape codes might be a place to start. http://en.wikipedia.org/wiki/ANSI_escape_code
Almost every game use keyboard as input. I have been searching for 2 days on this topic and found quite much about it. Keyboards have many disadvantages, but main problems I found are different layouts and second that if you are pressing 3 keys at time, it can lead to corruption (row-column error). If you don't know what I'm talking about, keyboard is made as grid and it checks which row and column has connected. But if you press E,D (row 1,2 column 3)
and R (row 1, column 4), keyboard can show even F because it find it pressed(row 2, column 4 both pressed).
So I think we can't do anything about that second, but if anyone got idea how to solve it better then use keys that don't form L, I'd be glad :)
But my main problem are different keyboard layouts which is real pain. I'm slovak so Slovak layout of numbers look like this:
+ľščťžýáíé and with shift 1234567890, we also got QWERTZ but you can use QWERTY.
You all know how the English look like but just for sure:
1234567890 and shift !##$%^&*()
Most of time I'm using english one because I got used to it when programming. Anyway there are different people using different layouts. When you are making game that depend on which key is pressed, for example good old WASD pattern, you can't use that on french one which is AZERTY layout. It would be strange. Same as using numbers for choosing gun in action game. As you can see slovak would have to press shift to get it work.
I'm also using OpeGL. There is problem when you are mapping which keys are pressed. For example widely used solution to make map of 256 bools for each charakter, is suffering from SHIFT. You press a, SHIFT and release a you got: a down, A up. So I thought about binding some keys together, as A and a, 1 and !, but then I realized I'll just change layout and everything is wrong.
So what is solution for that? I think there is someone out there that is in game industry or made some game and had to solve this. Only solution that comes on my mind is to force english layout for UI (and choosen layout for chat).
After next searching I found what I need but I need cross-platform one:
virtual key codes
And next search revealed SDL key
Result: Don't ever start with GLUT if you go making games, use SFML or SDL
Thanks to everyone for helping me, there were more problems in this so idea of key binding/mapping, SDL and so on, each helped me alot.
If you're getting a "character" every time user presses something, then your keyboard routines aren't suitable for game input - only for text entry.
You need to use input routines that completely ignore keyboard layout switching and operate on some kind of raw keycodes (so when user presses shift+a, you'll know that shift is pressed and that "a" key is pressed, but you won't get "A" character). Also, routines should allow you to query if a key is pressed or not.
For windows that is DirectInput or XInput. For cross-platform this is libsdl and SDL_GetKeyState. And you'll need to provide keymapping options for the user. Glut probably isn't suitable for your task.
The common approach seems to be to ignore the problem. Worse-is-better in its early stage.
Unfortunately I'm using svorak keyboard layout so it really doesn't just work for me.
I've been approaching this same problem by binding into multiple keys on the keyboard. So that player jumps from both x and j -keys. It doesn't do so well in something that isn't shoot-jump -kind of game.
Nice stuff would be if you could just find row/col or some driver-near interface to your keyboard.
Some auto-keyboard configuration software would be neat though I've not yet seen anything like that. Maybe we should write one?
First up, separate keypresses from text entry. You shouldn't care what letter or number comes up when you press a key with shift as well - the operating system should handle that and generate an event you can use in the rare times you need the text. Usually, you should just look for the key press and any shift presses and act on those.
Second, load the bindings from keys to commands from a data file, rather than hardcoding it. Distribute default bindings for QWERTY and whatever default layout you have. If the data format is quite straightforward then people won't mind customising it to fit their keyboard and preferences. You can also add an in-game keybinding editor later.
This isn't really about OpenGL since by default that doesn't care about keypresses. Perhaps you are using an addon library or extension that handles keys for you - ensure that whatever you're using can give you individual key values and the state of shift/alt/ctrl independently, and that it also provides text input via an independent system.
Allow your users to define the keys to use for each action ...
or use the arrow keys .. that should be pretty universal :)
Turn the keyboard input into metadata, so you could allow users to configure at their will but also provide different keyboard shortcuts depending on the keyboard layout used in a config file .
I want to implement basic spell checking in a Notepad clone project I'm doing. I want to underline misspelled words with a squiggly like like Word does. I think I need to use GDI and draw on the text field, but I'm not sure how to draw on controls.
Thanks
If you're basing your editor on an edit control (as Notepad does), then I think it's going to be difficult. By subclassing the edit control window, you could probably augment its WM_PAINT handling. But the problem is the control doesn't expose a way for you to find out exactly where a word appears within the control. Thus you won't know where to draw the squiggle.
You might be able to use a Rich Edit control (as WordPad does) and tweak the styling of the misspelled words. I've never used Rich Edit, so I can't help with the details.
Actually, I'm not sure about the method which you're using to render text in your window and I think you need to concretize it.
If everything is done using winapi/gdi (generally speaking, this would be TextOuting the current text block, that fits the window considering wrapping, etc...), you should add another routine, that would handle misspelled words rendering.
Again, this also depends on your way to save current text and it's parameters, but the idea is to implement some sort of function like RenderMisspelledWord(...), which would take your generic text-handling class or some kind of renderer class or even (X, Y, Length) as params. This function would be called from a more general Render method, which would be called from WM_PAINT handler.
What it would do also depends on your notepad architecture, but, for example, in last case that would require drawing * /\ /\ /\ * parts of your underlining using GDI (line) routines.
Generally speaking, every other case (with handling classes) would lead to the following action too, but with higher level of abstraction.