Commit Graph

192 Commits

Author SHA1 Message Date
Allan Odgaard
149d335335 Setup exception handler around editor_t::perform
The implementation of kPaste seems to generate an exception for some users, but I don’t know exactly why, so this should provide some better diagnostics info.
2013-03-20 11:30:41 +01:00
Allan Odgaard
315908e2d8 Update menu item titles in Text menu
These now reflect whether or not the action works on the selection.
2013-03-16 17:49:48 +01:00
Allan Odgaard
3a75199e9d Use menu validation to update bundle menu item titles
This means we don’t need to know if there is a selection when creating the menu items and long-term it’ll be easier to introduce more complex updating, e.g. make the title a format string to allow referencing TM_DISPLAYNAME or disable the menu item if its requirements cannot be met.
2013-03-16 17:49:48 +01:00
Allan Odgaard
d8cf1e3591 Gather UI construction code and harmonize fonts 2013-03-13 12:38:11 +01:00
Allan Odgaard
be65671e52 Fix shell quoting for selected files
There would be a pair of redundant single quotes after each quoted path.
2013-03-10 16:07:09 +01:00
Allan Odgaard
14cfedb287 Implement Replace [and Find] bound to ⌥⌘G
Currently this is implemented in OakTextView which means that it doesn’t work for macros. Some refactoring is in order so that the implementation can be shared (lack of sharing has to do with how OakTextView reports status to Find dialog or via tool tips, and macros want none of that).

There is also no check to see if the current state of the editor is the result of a find operation, i.e. you can invoke “replace” regardless of wether or not “find” was the last action.

Finally, doing a multi-file search and using “find next” at the end of one document, which brings you to the first match of next document (part of the results), will not update “captures” from a potential regular expression search, meaning that if you then do “replace”, and your replacement string is a format string that references the match (via $1-n) then it will not be correctly expanded.

Closes #104.
2013-03-07 16:21:57 +01:00
Allan Odgaard
5ad6d0c5c0 Simplify implementation of OakTextViewFindServer 2013-03-07 16:21:56 +01:00
Allan Odgaard
02f32977f2 Introduce Replace [and Find] in find protocol
Previously there was a single replace action and the options would indicate if it was a “replace all”, this mimics the “find” (which can be a “find all”) but since single match replacement is somewhat different than a “replace all”, as the former may need to know the captures from a previous find action, it makes sense to factor out these things as different actions.
2013-03-07 16:21:47 +01:00
Boris Dušek
f4e2de14f2 Present the document view as a group to VoiceOver/accessibility
This enables VoiceOver user to see the document view as a single
element and interact with it (i.e. inspect its subelements) only when
needed by using the VO-Shift-down shortcut (and stop interacting with
it using VO-Shift-up shortcut). This makes the element structure more
hierarchical where at the top level are only major user interface
components, so that it's easier for orientation. It also prevents
unrelated UI elements to be sequential as VoiceOver by default orders
elements by the visual order (top-down, left-right) rather then
the order in the AXChildren array. For example in this case,
the bottom status bar of the document window gets separated from
the bottom toolbar of the file browser, unlike the situation before
grouping when both bars were adjacent to the VoiceOver user.
2013-03-03 15:53:04 +01:00
Boris Dušek
944e1e32fa Make macro recording an NSToggleButton
This fixes semantics of the button and thus also its
accessibility. The macro recording button represents state - more
specifically a boolean state, so it has to be a NSToggleButton (or
its specialization). Then the button is presented to the VoiceOver
user as an AXCheckbox - that is a checkbox with on and off value -
which is exactly what the button's function is. Examples of this in
system apps is e.g. the "Play" button in QuickTime Player, which is
also an AXCheckbox ("Pause" is then simply an unchecked "Play"
checkbox).
2013-03-03 15:42:18 +01:00
Boris Dušek
21c70057b4 Fix initial accessibility of symbol pop-up
VoiceOver reads an AXValue for a pop-up button - that is the selected
item. But button's title does not set an AXValue, as it probably is
not a menu item. So change the code set to the title by setting a
single menu item with that title.

This fixes accessibility of the pop-up when accessing its value before
it is first popped up. It makes the code consistent with setGrammarName:
which works fine (that's how I discovered how to fix it).
2013-03-03 15:41:54 +01:00
Boris Dušek
baf2839299 Add AXDescription to pop-ups to tell about their purpose 2013-03-03 15:41:48 +01:00
Boris Dušek
c3f57b0235 Add AXDescription to image buttons 2013-03-03 15:40:39 +01:00
Steven Clukey
7892eac2d4 Add “scroll past end” option to the View menu
When enabled the height of the document is increased by the height of the view port, which means the last lines of the document are not anchored to the bottom of the view port but can e.g. be centered.

Closes #513.
2013-03-03 15:14:29 +01:00
Allan Odgaard
f7f3fc3638 Copy incremental search string
Fixed #631 (again).
2013-03-02 09:26:35 +01:00
Allan Odgaard
acd3bdf234 Convert leading em-spaces in symbol menu to item indent
By using the menu item’s indentation level property it is possible to “type to select” items, which previously would not work for items that had leading em-space as a prefix.

Closes #806.
2013-02-20 18:08:24 +01:00
Allan Odgaard
77f53c3e3e Use a const reference for gutter colors 2013-02-18 15:38:27 +01:00
Allan Odgaard
22b00f2848 Remove unused ‘textColor’ parameter 2013-02-18 15:38:26 +01:00
Allan Odgaard
95b4055772 Fix debug output
Also add leak-watching to OakTextView.
2013-02-16 10:43:55 +01:00
Allan Odgaard
d127483dcc Fix retain cycles
Fixes #794
2013-02-16 10:43:55 +01:00
Michael Sheets
ecd666f24a Improve constraint widths for status bar.
- Set compression priorities to collapse fields in a desirable order.
- Increase default width of selection string to fit 8888:88
- Set grammar popup to the width of the active grammar and give is sensible minimum/maximum widths.
- Set a maximum width for the tab size menu.
2013-02-15 07:09:48 -06:00
Allan Odgaard
3669e671c7 Strip “offset” from selection string in status bar 2013-02-14 11:31:21 +01:00
Allan Odgaard
83505a47e2 Change status bar’s “caret” property
We now use a selection string so status bar doesn’t need to know about what it actually contains.
2013-02-14 11:31:21 +01:00
Allan Odgaard
94f0c803f7 Limit status bar redraw
The NSPopUpButton itself will not bypass redisplay even if it’s title is set to the current title.
2013-02-14 11:31:20 +01:00
Allan Odgaard
43fa57ae22 Don’t draw status bar background on window border 2013-02-14 11:31:20 +01:00
Allan Odgaard
9338109452 Fix NSTimer related crash
The timer might be the only thing keeping us retained, so we can’t release it until the very end of the method.
2013-02-14 11:31:20 +01:00
Michael Sheets
05af681717 Truncate the selection string when it grows too long. 2013-02-14 11:27:53 +01:00
Allan Odgaard
8f3e99bc79 Gutter height now accounts for horizontal scrollbar
Previously the gutter and the text view were set to have the same height (via constraints). Though when the horizontal scrollbar is visible then the gutter should technically be made a little taller to account for the extra bottom margin. Not adding this space was causing problems.

Fixes #773.
2013-02-13 10:51:07 +01:00
Allan Odgaard
3bc3db00aa ARC: Update OakTextView framework 2013-02-12 23:06:48 +01:00
Allan Odgaard
f886b0cb13 Update text view status bar to use system controls 2013-02-12 21:55:56 +01:00
Allan Odgaard
402e1f79b1 Use one bundle menu delegate for all menus
This avoids the problem of keeping the delegate retained while the menu is up (the menu item exists).
2013-02-12 20:11:50 +01:00
Allan Odgaard
4a812117e7 Fix memory leak 2013-02-11 15:17:30 +01:00
Allan Odgaard
a9e59f5308 Set spelling language for current folder when changed via UI
Previously we would set it for the current file (via path) and the current scope plus parent scopes.

The latter wasn’t useful, as the file type is not indicative of the language used, and as scoped settings presently have higher priority than path-based settings, it could lead to the wrong language being used, even when language was explicitly set for a folder.

Now, when changing language via Edit → Spelling menu, we set the language globally (so default for all new documents without more specific settings), all files in the current document’s folder, and the document itself.
2013-02-11 14:21:23 +01:00
Allan Odgaard
bdadf0f17f Let text view reset cut/copy menu item titles
This is necessary since opening the Edit menu with focus in file browser may update the titles to reflect files that would be cut or copied.
2013-02-11 14:21:23 +01:00
Allan Odgaard
f5541b2a1c Don’t try to toggle caret with no layout 2013-02-11 14:21:21 +01:00
Allan Odgaard
8fb95309c1 Reset undo/redo menu item titles
The undo manager will change the titles (e.g. “Undo Rename”) when it’s first responder, so we need to change them back, when the text view is first responder.
2013-02-11 14:21:21 +01:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
fbb2f972f9 Don’t mark parent views as opaque
The reason for this is that NSTextField will draw itself in the “faded” state (for non-key windows) unless some of its parent views are marked opaque.

The previous problem with not having the parent views opaque (see da3a91a7bb) seems to have been solved by setting the autohidesScrollers property to YES.
2013-02-06 14:50:04 +01:00
Allan Odgaard
ad750b0b76 Auto-hide the text view’s scroll bars
This is for users who have set “show scroll bars” to “always” (or auto and am using a mouse).

Closes #527.
2013-02-06 14:50:04 +01:00
Joachim Mårtensson
8de62bbc85 Don't mutate shared themes 2013-02-04 20:44:21 +01:00
Allan Odgaard
32fcb52c68 Workaround for clang linker warning
Using instances with static storage in Objective-C files result in the following warning (starting with clang 425.0.24):

ld: warning: direct access in […] to global weak symbol […] means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
2013-02-02 08:52:12 +01:00
Allan Odgaard
0413f35eeb Rework symbol chooser code
The symbol chooser is now owned by DocumentView instead of DocumentController.

The symbol chooser does not know about its owner and is not an observer of any notifications. Instead it has a property for “document” and one for “selectionString”. It is the owners job to update these properties (i.e. when switching document or changing the selection).
2013-01-30 16:17:32 +01:00
Steven Clukey
b9d9e9140a SymbolChooser live-updates its selections
This code is public domain.

Closes #166.
2013-01-30 16:00:04 +01:00
Allan Odgaard
99203d332d Proper refresh when dropping files on text view 2013-01-29 15:31:11 +01:00
Allan Odgaard
18998cba53 Drop snippets on undo
This isn’t ideal but better than a potential crash (following the next edit). A better solution will have to wait to a larger refactoring (which should also consider multiple editors working on the same buffer).

Closes #186.
2013-01-29 15:31:10 +01:00
Allan Odgaard
adb2ed7b64 Use sel_getName() instead of typecast 2013-01-29 15:28:22 +01:00
Allan Odgaard
269a6ae3c2 Use “standard” divider above incremental search 2013-01-28 15:44:27 +01:00
Allan Odgaard
4e76b6f41e Use last string when bringing up incremental search
Closes #631.
2013-01-28 15:44:27 +01:00
Allan Odgaard
036a53582c Replace live search xib with code 2013-01-28 15:44:27 +01:00
Allan Odgaard
456209730d Improve autoscroll when drag-selecting outside viewport
When user drag-selects and moves mouse outside the viewport, we do not want to use ‘ensureSelectionIsInVisibleArea:’ because that method looks only on the selection, particularly the non-anchored end-point (and works differently for unanchored selections). Instead we want to scroll the point corresponding to the mouse position inside the viewport.

Fixes #475.
2013-01-28 12:42:28 +01:00