Commit Graph

285 Commits

Author SHA1 Message Date
Allan Odgaard
b568f2e788 Handle dropping CR delimited text
Also filter malformed UTF-8 sequences from dropped text.
2013-11-28 17:07:55 +07:00
Allan Odgaard
888ccbed16 Remove use of NSPointToCGPoint
This is not required when building in 64 bit mode or when defining NS_BUILD_32_LIKE_64.
2013-11-18 22:43:50 +07:00
Boris Dušek
22a5dc1413 Support getting AXVisibleCharacterRange accessibility attribute 2013-11-15 18:14:03 +07:00
Boris Dušek
c7fbcf06ed Fix accessibility visual bounds ending at line boundary
Accessibility visual bounds for a range of a single softline should always
be also visually restricted to the softline. This is in order to be consistent
with implementation in Apple's apps (e.g. TextEdit).
2013-11-15 17:58:28 +07:00
Boris Dušek
9f68cb416c Use softlines instead of hardlines for accessibility
Fixes #1149.

VoiceOver expects AXLineForIndex and AXRangeForLine to be consistent with
the movement by line using arrow up/down. That means it expects "line"
to mean softline.

VoiceOver also distinguishes commands to move by:
* paragraph (hardline): VO-Shift-PgUp/PgDown
* line (softline): VO-up/down

These are available when interacting with the text area (VO-Shift-down).

This commit therefore fixes the AXLineForIndex and AXRangeForLine
to make "line" mean "softline" instead of "hardline" as was the case
until now.
2013-11-15 17:58:18 +07:00
Boris Dušek
5dcca0996c Support text links with VoiceOver
Now links in text (e.g. links to RFCs after installing the Hyperlink Helper bundle)
are announced as such with VoiceOver and it is possible to search for them with
VO-Cmd-L.

TODO:

* launching links with VO-Space is not supported yet, but Enter (Fn-Return)
  does the same thing and is even more reliable.
* link URL is not supported, so it is not possible to learn the URL
  with VO-Shift-U.
2013-11-15 16:09:02 +07:00
Allan Odgaard
8f90f8f602 Defensive programming
Seeing a common crash on quit which might be due to drawRect: being called when the OakTextView is in a partially destroyed state.
2013-11-04 14:09:27 +01:00
Allan Odgaard
2df3118e34 Do not set window as opaque when gutter background is transparent
Previously only the text view’s background would affect the window’s opaque property, which made it impossible to have a solid text view background with a transparent gutter.
2013-11-03 20:37:48 +01:00
Allan Odgaard
7402a7835b Opt out of responsive scrolling
With responsive scrolling we need to return NO from isOpaque in order to get transparency and we cannot overload the scrollWheel: method (which we use to forward mouse events from the gutter to the text area).

I have also received a few crash reports that might be caused by responsive scrolling and one user has reported “sticky” scroll behavior.

So for now better just disable it, and see if it fixes all these issues.

Fixes #1135
2013-11-03 20:37:48 +01:00
Allan Odgaard
e16bacb6f9 Loosen rules about tab trigger boundaries
Previously the character before the potential tab trigger had to be of a different character class. This is now only required when the first character of the tab trigger is a word character.
2013-10-30 21:35:08 +01:00
Allan Odgaard
734f24552d Update symbol chooser to use OakChooser
Fixes #1160
2013-10-27 20:07:48 +01:00
Allan Odgaard
3064fb82b4 Change text::range_t → ng::range_t 2013-10-20 19:10:02 +02:00
Steven Clukey
bbe1ca357b Add “invisiblesMap” option to the .tm_properties file
This setting allows changing which invisibles are shown and what glyph
is used for them.

Invisibles are '\t', '\n', and ' ', to turn one off, add ~[\t \n] to
the settings string. To set the glyph used for the invisible, add [\t
\n][glyph_to_use].
2013-10-08 23:06:29 +02:00
Allan Odgaard
186af2fb21 Always place bookmarks on top of “search marks”
Logically I think the less temporary marks should be eclipsed, but this currently lead to inconsistencies with respect to hover images, e.g. hovering a search mark that also has a bookmark should show “remove bookmark” which it presently doesn’t, and will require a bit of refactoring to allow.

Issue #1132
2013-10-05 14:32:37 +02:00
Allan Odgaard
fe9b6b0721 Workaround for Xcode 5
My interpretation: The old inline array is interpreted as an initializer list which cannot (yet) be used with Objective-C objects when ARC is enabled.

Fixes #1037
2013-09-22 12:55:42 +02:00
Boris Dušek
21088105a8 Support text attributes with VoiceOver
VoiceOver can announce text formatting, such as bold font, italics,
underline, font, etc., as well as whether text is misspelled. For this,
it needs the AXAttributedStringForRange attribute supported. This commit
does exactly that.

Testing can be done in this way (VO stands for Ctrl-Option):

* first interact with the text (VO-Shift-down arrow when standing
  on the text element)
* to announce text attributes for character after cursor, press VO-T
* to seek for next:
  * misspelled text: VO-Cmd-E
  * color change:    VO-Cmd-K
  * underlined text: VO-Cmd-U
  * many more (see VO-H-H, "Find", close help with Esc)
* to seek for previous *: just add Shift to the shortcut

Some attributes remain to be supported (full list of attributes is available at: https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/Protocols/NSAccessibility_Protocol/Reference/Reference.html#//apple_ref/doc/uid/20000945-SW53).

The misspelled text VoiceOver support can be used nicely with TextMate's
spelling support:

1. the user finds next mistake with VO-Cmd-E, hears the misspelled word,
   perhaps reads it on a braille display
2. the user then presses Cmd-; to show the spelling menu for that word
   and chooses the desired resolution (apply suggested correction etc.)
3. go back to step 1. :-)
2013-09-12 23:13:57 +02:00
Allan Odgaard
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
145a4f6386 Implement NSChangeSpelling and NSIgnoreMisspelledWords 2013-09-05 12:41:30 +02:00
Allan Odgaard
b832a8d7d0 Use specialized menu for Check Spelling
We only show “Find Next” (previously “Show Next”) when context menu is shown as a result of “Check Spelling” and we leave out the other actions.
2013-09-04 12:55:16 +02:00
Allan Odgaard
68bf3efff9 Synchronize spelling panel and buffer languages
If the spelling panel is visible when checkSpelling: is invoked then its language is taken and used for the buffer. If the panel is not visible, the buffer’s language is set for the spelling panel.

We probably should also set the spelling panel’s language when switching document, and when the panel is first opened. I don’t think the code complexity is really worth it though (depends on how often one use the spelling panel with a non-default language).

Fixes #1104
2013-09-04 12:55:16 +02:00
Allan Odgaard
d265d24441 Enable “Check Spelling as You Type” in checkSpelling:
This is required so that we have the proper meta data (misspelling ranges).
2013-09-04 12:55:16 +02:00
Allan Odgaard
160dcf50af Use local variable for document->buffer() 2013-09-04 12:55:15 +02:00
Allan Odgaard
13ca6b731e Update spelling panel and use when visible 2013-09-04 12:55:15 +02:00
Allan Odgaard
a20778f5de Enable text view’s context menu actions 2013-09-04 12:55:15 +02:00
Adam Strzelecki
de21c812a9 Only show suggestions when Check Spelling is called via menu item
Otherwise just select next spelling error on Check Spelling, which is called by
spelling panel as well.
2013-09-03 15:06:40 +02:00
Adam Strzelecki
b0b182e2e1 Invalidate spelling when ignoring or learning a word
We invalidate the entire buffer since the word can appear in multiple locations. This could be optimized to only invalidate misspelled instances of the ignored or learned word. Likewise, we redraw entire buffer since the refresh macro is not able to handle changes in spelling meta data and calculate minimal refresh region.
2013-09-03 15:06:40 +02:00
Adam Strzelecki
6997fb820e Reduce text overlap when showing context menu 2013-09-03 15:06:40 +02:00
Adam Strzelecki
cc137f3c24 Add Show Next for quick spelling iteration
Also add key equivalents to spell popup menu.
2013-09-03 15:06:40 +02:00
Adam Strzelecki
6c6316573f Implement Check Spelling
Now using Edit -> Spelling -> Check Spelling selects next spelling error or one
at caret if it was not yet selected, then shows context menu with correction
suggestions.

This makes checking spelling as easy as tapping Cmd+;

Closes #1103
2013-09-03 15:06:07 +02:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
d58bb1fdde Avoid using NULL_STR with scope_t::push_scope 2013-09-03 12:10:18 +02:00
Allan Odgaard
c1f14616a5 Use ‘char const*’ with scope_t::push_scope
This is to allow distinguishing between static and dynamic strings.
2013-08-30 12:30:33 +02:00
Allan Odgaard
d93b20d571 Use new scope_t API 2013-08-28 00:23:08 +02:00
Allan Odgaard
057096af5b Rename API to make searching easier
Using generic names like ‘append’ is not good when analyzing code for potential refactoring.
2013-08-27 15:30:09 +02:00
Allan Odgaard
bcece9a8e5 Don’t make selection visible when nothing is found 2013-08-26 12:02:29 +02:00
Allan Odgaard
41b4f03712 Let gutter view observe frame changes from OakTextView
Previously it would only observe NSViewBoundsDidChange from the clip view containing the text view, and while it worked most of the time, it failed to see notifications when a text view was smaller than the clip view’s view port and grew, yet still staying smaller than the view port.
2013-08-12 23:49:00 +02:00
Allan Odgaard
772143088a Rework code to avoid strange crash
I’m seeing a crash in ‘-[OakDocumentView dealloc]’ stating that “selectionString” is not being observed. This would indicate that a OakDocumentView instance is created that doesn’t go through the designated initializer, how that can happen is beyond me, but with the reshuffled code, if it happens, it should no longer cause a crash in dealloc.
2013-08-12 22:57:57 +02:00
Allan Odgaard
a68d206468 Add more info to crash reports 2013-08-12 22:57:56 +02:00
Allan Odgaard
a52165694c Move crash reporter info support to own framework
This is to avoid cyclic dependencies since it was previously in a somewhat high-level framework, so everything that framework depended on, could not augment crash reports.
2013-08-12 19:32:23 +02:00
Allan Odgaard
231f1f8160 Improve application specific data in crash log
This makes it easier to automatically extract and index.
2013-08-10 11:55:39 +02:00
Allan Odgaard
f17f49e95d Spelling suggestions can be chosen with 1-n 2013-08-10 00:51:27 +02:00
Allan Odgaard
1c783fede9 Use implicitly synthesized properties 2013-08-06 15:00:04 +02:00
Allan Odgaard
f4828036fe Preserve document’s scroll offset when changing soft wrap or font
Technically we preserve which line is the first visible.

Fixes #993.
2013-08-04 15:18:40 +02:00
Allan Odgaard
faf30e4786 Update document dimensions before restoring scroll position
Since the document starts out the same width as the view port, horizontal scroll position was effectively never restored, fixes #605.
2013-08-04 14:40:27 +02:00
Allan Odgaard
2c0010a141 Restore “first visible character” instead of visible rectangle
This is when switching tabs ore re-opening a file.

Restoring the visible rectangle doesn’t always work because we do an initial heuristic layout where we don’t do proper soft wrap and may also lack scoped settings to increase font size for headings, meaning that the restored visible rectangle does not point to the same section of the text, as it would with a fully updated layout.

This fixes #243.
2013-08-04 14:36:45 +02:00
Allan Odgaard
ad44540209 Use document’s indent accessor instead of going via buffer() 2013-07-29 12:43:37 +02:00
Jacob Bandes-Storch
79a1f49ec5 fixup! Show a tool tip when searching wraps around 2013-07-28 00:15:45 +02:00
Allan Odgaard
6718a8a32c Use libdispatch for threaded write to pipe 2013-07-26 23:09:14 +02:00
Allan Odgaard
974d027f23 Include key event in potential crash reports 2013-07-24 15:56:19 +02:00
Allan Odgaard
70411fa11a Show a tool tip when searching wraps around
Closes #1049, although the visual feedback could be improved (see issue).
2013-07-23 22:50:29 +02:00