How to convince NSTextView that text starts at the bottom? - macos

I will append some strings to NSTextView, but I want them to start at the bottom. New appended string should go underneath the last appended string.
In Java or C#, one can set VerticalAligment = bottom, but I can't find any appropriate way to achieve this in Cocoa... Any thoughts?
EDIT:
I guess I didn't specify precisely enough what I want, so I'll append two pictures. First is what it looks now, second one is what I want. Basically, the newest string is always at the bottom and the older ones gets pushed up. Makes sense now?

Related

AppleScript in Automator broken in Big Sur

So, I had a pretty simple Automator task that I used from the 'Services' right-click pop-up menu in Finder that copied an image, renamed it, scaled it, then added a border around it. Worked fine for ages. The final step of it is to do the padding in an AppleScript, which starts with this incantation:
on run {input, parameters}
set this_image to item 1 of input
...
And is meant to continue with this_image set to the file path from the previous step.
Since Big Sur, I get an error
The action “Run AppleScript” encountered an error: “Can’t get item 1 of {}.”
Which seems to indicate that input is now an empty list. So — perhaps the previous action (Rename Finder Items: Replace Text) does not pass a result — or something else.
Quick search via Google does not yield any clues, except some indication that breaking changes are part of the game and Apple doesn't really indicate what would break.
Any ideas? Every other step works fine — as I single-step, the file is manipulated as expected (duplicated, renamed, scaled, etc.). It's only when it gets to this line where I expect to have a filename in order to do the padding that there's an issue.
(Also, just in case someone wants to suggest using the 'Pad Images' automator action — the padding it performs isn't my kind of padding — it puts padding around the entire image. I just put padding at the top and bottom turning a 3x2 image into a square with the image proper sandwiched between white borders, top and bottom.)
The issue appears to be at one particular text replacement step, where I attempt to replace a string with a leading space with an empty string. For some reason, that fails — I am not sure why. But, when I change that particular step ('Rename Finder Items: Replace Text') to replace any string with a leading space with another character (say, an '_') it works fine. So I am deducing that replacing something with an empty string is the culprit, but I'm not 100% sure. But, now my Automator workflow works having adjusted that particular step.

Cursive navigate forward/back word within a comment line

Alt-left & Alt-right (the emacs key-bindings that work across many apps in Mac OS, including as I type now into chrome), instead of doing forward and back word, go forward and back form (i.e. lisp form).
This is a much higher level navigation, frustrating at first, but actually turns out quite usable because you can just bump one char into a form if you don't want to jump over it, then you can navigate by word within it just fine.
This is fine except within a comment line. There, the usual forward and back word break completely, simply jumping you back to the previous form (comment lines are ignored) or on to the next.
It would be great to be able to make cursive/intellij respect forward/back word within a comment line if possible but I have no idea how to modify this particular behaviour. It seems deeper than just modifying a key binding, if I'm correct.
It turns out these keys in cursive/intellij are bound by default as follows (note Alt-right is by default bound to both of the below):
and
The second was overriding the first, the one wanted here.
So by removing the alt binding to make it look like:
Plus the same for back, it now works as desired :)

DataGrip current statement highlighting

I installed DataGrip and spent a couple hours getting rid of bells and whistles that distract me from editing sql, like the lightbulb. I'm down to this one that for my life I can't figure, so when I move around with the caret, the editor comes up with what it thinks is the current statement and draws a thin border around it, say if it's a line ending in a semicolon, it will border just that line, but if I have several statements each not ending in semicolon, it will think they all make up a single one and draw the rectangle around the whole thing. This in itself is distracting, plus if I hit Enter within the border, it will indent differently according to what it thinks the whole thing is. I just want Enter to go to a new line at the 0, leftmost position.
Is there any way to turn the whole feature off completely?
Apart from that, does anyone know if it's possible to get DataGrip to display the number of rows affected after an INSERT or UPDATE, like most other tools do?
I'm using it with Postgresql. Thank you in advance!
cpp_developer! (By the way, what do you think about CLion? :)
There are several questions in one, let's get answers one by one.
Lightbulb: there is no UI for getting rid of it, but there is the way. It is described in this ticket: https://youtrack.jetbrains.com/issue/IDEA-94381
TLDR:
Following line should be added to the
$IDE_CONFIG_HOME/options/editor.xml then:
<option name="SHOW_INTENTION_BULB" value="false" />
Line showing the current statement.
It can be removed, like any other color/font thing: A small helpful action. For now it is only present in the Find Action menu (Ctrl/Cmd+Shift+A), but as usual, you can assign any shortcut to it.
This action will navigate you to the settings which are relevant to the context under the caret. If there are several of them, just choose one. In your case "Statement to execute". Then remove it or make white.
Smart indenting. Just turn this off:
Number of INSERTed and UPDATEd rows can be found in Output tab. But please, run them in batch mode -> context menu "Run %your_console%.sql"

Change item order in plist file

I want to change order in plist file not programmatically but from xcode. Is there a way in Xcode where i can sort by value? I simply want to arrange it for myself. For now if i want add new item it will always goes to tail.
How to sort it ? To 100 value go to the top?
Here is the (mildly infuriating) answer, at least in the case of Items in a Settings.bundle's plist, which I realize was not the OP's situation.
To arbitrarily reorder items in a plist:
Target the row by clicking within the Value column. The left-most columns don't allow dragging.
Drag into the first ~64 pixels of the Key column. A blue line appears to indicate where the row will appear when you let go.
Here's a demonstration in Xcode 9.2.
As if that's not already super confusing…
Preference Items, Vertical Drag
You can drag and drop vertically (i.e., without entering the Key column), but only if your goal is to move the item to be first in the list.
Apple Clearly Knows How to Do This
Once you open an Item, elements within it can be dragged and dropped exactly as you'd expect.
Wat!? Yeah. This doesn't need to be so painful, but it's likely to remain this way unless folks get up in arms which, once you know the workaround, it's hard to do. But in case you're feeling sufficiently incensed, make your voice heard: http://bugreporter.apple.com. (Fwiw, here's my Open Radar.)
Your can edit a plist file with an text editor. Right click on plist file -> open as -> source code.
and i think you have to put you strings in an Array

Fastest way to "jump back" to a file in TextMate?

Often, when I am reading code or debugging, I want the ability to quickly jump around files. I especially want to "go back" to where I was. I know about "Command+T", "Command+Shift+T", and, bookmarks. But, I cannot figure out a way to jump around files quickly.
UPDATE: I do not think I my question was clear enough judging by two answers given. Specifically, I am looking for a way to "jump back" to where I was in a file. I know how to navigate in TextMate (in general). I want to know if TextMate has a "jump back" key binding.
It's subtle.
The command-T thing has the files listed in Most Recently Used order.
So, you can go command-T return to get back to your last file real quick. At first I couldn't find it either.
I don't think there's a go to last edit location as there is in, say, IDEA/RubyMine.
Courtesy of MacroMates.com
2.3 Moving Between Files (With Grace)
When working with projects there are a few ways to move between the open files.
The most straightforward way is by clicking on the file tab you need. This can also be done from the keyboard by pressing ⌘1-9, which will switch to file tab 1-9.
You can also use ⌥⌘← and ⌥⌘→ to select the file tab to the left or right of the current one.
It is possible to re-arrange the file tabs by using the mouse to drag-sort them (click and hold the mouse button on a tab and then drag it to the new location). This should make it possible to arrange them so that keyboard switching is more natural.
One more key is ⌥⌘↑ which cycles through text files with the same base name as the current file. This is mainly useful when working with languages which have an interface file (header) and implementation file (source).
When you want to move to a file which is not open you can use the Go to File… action in the Navigation menu (bound to ⌘T). This opens a window like the one shown below.
Go To File
This window lists all text files in the project sorted by last use, which means pressing return will open (or go to) the last file you worked on. So using it this way makes for easy switching to the most recently used file.
You can enter a filter string to narrow down the number of files shown. This filter string is matched against the filenames as an abbreviation and the files are sorted according to how well they match the given abbreviation. For example in the picture above the filter string is otv and TextMate determines that OakTextView.h is the best match for that (by placing it at the top).
The file I want is OakTextView.mm which ranks as #2. But since I have already corrected it in the past, TextMate has learned that this is the match that should go together with the otv filter string, i.e. it is adaptive and learns from your usage patterns.
If you have a project window open, you can leave frequently-accessed files open (in tabs), and then use ⌘+1-9 to jump to open tabs.

Resources