Commands can prepare the document for saving in this callback, e.g. strip trailing whitespace (issue #35), ensure the line always has a newline character as the last byte in the document (issue #76), or similar.
Presently having a “will-save” command fail does not abort saving (but likely should). Also, there is no check to see if the command called requires the document to be saved before running, so that likely leads to an infinite loop.
The text view needs to do a little work before saving a document (serialize folded text) and with the window as part of the user data, we can now skip that for text views in windows for which documents are not going to be saved.
This is not an ideal solution; long-term saving will be moved up to the DocumentWindowController which has the full view of all documents and text views.
The methods going to “begin of indented line” will go to the first non-whitespace character on the line, unless the caret is already there or to the left of this character, in which case it will go to the actual beginning of the line.
The “end of indented line” methods work similarly.
If you want [⇪]⌘⇠/⇢ and ⌘⌫/⌦ to use this behavior, you can add the following to your key bindings file:
"@\UF702" = "moveToBeginningOfIndentedLine:";
"$@\UF702" = "moveToBeginningOfIndentedLineAndModifySelection:";
"@\UF703" = "moveToEndOfIndentedLine:";
"$@\UF703" = "moveToEndOfIndentedLineAndModifySelection:";
"@\U007F" = "deleteToBeginningOfIndentedLine:";
"@\UF728" = "deleteToEndOfIndentedLine:";
Command-clicking an existing caret normally toggles, unless there only is a single caret, in which case it adds a caret. This would thus allow you to add a new caret sharing the position of the existing, and command-clicking again would then remove both the two existing carets, leading to an assertion failure (as there were no carets).
Fixes issue #466.
There are several crashes reported from firstRectForCharacterRange: which indicate that the system may ask for indexes “out of range”, hence why we now effectively just cap such request.
The refresh helper uses the document’s undo manager in its destructor. Normally the document would stay open throughout the duration of the scope in which the refresh helper is used, but it might be possible to close the current document from a nested event loop, as spawned e.g. by showing a tool tip, in which case, the document will be closed when we reach the destructor.
It’s not feasible to maintain the old-style xib translations while we work on the UI. We’ll soon move fully to constraint-based layout which should allow translations to be purely string-based.
The gutter will invalidate its intrinsic size when its width changes which will cause the Cocoa layout engine to update the layout, so no more explicit code to deal with adjusting the gutter’s width.
Likewise, the height of the gutter (not the gutter scroll view) has been setup to match the height of the text view (again, not the containing scroll view). This avoids observing the text view frame and manually updating gutter height to match it.
There’s a few subtle advantages of going with a view, mostly theoretical (about minimizing refresh rectangles) but switching to constrained based layout should provide minor code simplifications, since our ancestor view won’t have to deal with the gutter divider rectangle.
This is an ongoing effort to refactor and simplify OakTextView. The goal is to move decisions up the hierarchy and instead have properties on the objects lower in the hierarchy (making the components more flexible and allowing for better decision making at the higher level).
We now require this to be set when changing theme, rather than have the IBeamCursor getter return a cursor appropriate for the current theme.
When switching themes we need to update several UI elements (scrollview background and knob style, gutter view, and possibly more in the future) so we might as well move the logic that picks the proper cursor color to this setup code.
Both from code and the menus. These were not implemented and I see no real reason to implement freehanded movement as a toggle since it is easily obtainable via column selections or option-clicking beyond EOL.
Overwrite mode might be implemented, but rather low priority.
1. Removed the alpha channels from all images.
2. Deleted unnecessary double images. (@sorbits: You might want to
rename them to more accurately display what they do.)
3. Slight adjustments to improve the visibility of the bookmark icons
at lower font sizes.
The advantage is that we avoid creating an off-screen image for compositing. We want to avoid off-screen images as they may not use the same pixel format/density as the render context (screen).
This removes all the blending, the need to provide a scope selector to obtain them, and no longer taxes the general syntax highlight (by no longer having to carry around a dozen gutter styles per scope).
When we update the text view frame we implicitly cause the gutter to refresh, which will ask for line records from the text view based on the selection, so we should ensure the selection is up-to-date before changing frame size.