Commit Graph

4079 Commits

Author SHA1 Message Date
Allan Odgaard
fe301508c8 Introduce perrorf as shorthand for fprintf with strerror 2016-08-28 17:25:19 +02:00
Allan Odgaard
4c8308b520 Use perror instead of fprintf + strerror 2016-08-28 17:24:14 +02:00
Allan Odgaard
c0d6967480 Let OakTextView store an OakDocument instance instead of document_t 2016-08-28 17:23:05 +02:00
Allan Odgaard
9d48b5683b Don’t let OakTextView use any of the document_t wrapper methods 2016-08-28 17:22:06 +02:00
Allan Odgaard
c78473dc6c Make OakDocument’s visibleIndex and selection properties public 2016-08-28 17:21:35 +02:00
Allan Odgaard
c942dde920 Only use OakDocument in document_view_t
Also change indent property to tab_size and soft_tabs.
2016-08-28 17:20:08 +02:00
Allan Odgaard
9c4589d541 Inform callbacks about updated scopes when interrupting “batch parsing”
We delay updating callbacks until we have parsed 10 lines to avoid line-by-line redraw of the screen, but incase the buffer got mutated during this batch parsing, we would previously restart the parser and forget about the ranges already parsed (that no-one had been told about).
2016-08-28 17:03:58 +02:00
Allan Odgaard
7029992159 Only suppress “did parse” callback when next dirty line is our next line
Incase something earlier in the document became dirty, while in batch update mode, we would keep using the old value of ‘batch_start’ when eventually calling ‘did_update_scopes’.

Under normal circumstances though making the buffer dirty would bump the revision, which drops the batch info, but if e.g. we change grammar, we mark the document dirty without bumping the revision.
2016-08-28 17:03:58 +02:00
Allan Odgaard
8dd33c654c Pass function parameter by value instead of const-reference 2016-08-28 17:03:58 +02:00
Allan Odgaard
5df4da9eb3 Removed unused function parameter 2016-08-28 17:03:58 +02:00
Allan Odgaard
6959ca68f3 Dismiss “Stop Command?” HTML output dialog if command exits by itself 2016-08-28 13:40:56 +02:00
Allan Odgaard
ba8dfaf9fd Remove some unused document::run delegate methods 2016-08-28 13:32:49 +02:00
Allan Odgaard
c7d3aa3649 Move show_command_error to DocumentController 2016-08-28 13:32:49 +02:00
Allan Odgaard
14782c0aea Remove old custom URL protocol 2016-08-28 13:32:49 +02:00
Allan Odgaard
e282dc2fd2 Remove commandRunner from HTMLOutputWindow and DocumentController 2016-08-28 13:32:49 +02:00
Allan Odgaard
0153e837a8 Remove document::run API 2016-08-28 13:32:49 +02:00
Allan Odgaard
15d4f6c122 Use executeBundleCommand:variables: in editor_t’s command runner 2016-08-28 13:32:49 +02:00
Allan Odgaard
350db382d9 Use executeBundleCommand:variables: in performBundleItem: 2016-08-28 13:32:49 +02:00
Allan Odgaard
5783cceac7 Use executeBundleCommand:variables: in dropFiles: 2016-08-28 13:32:49 +02:00
Allan Odgaard
991822635f Use executeBundleCommand:variables: in filterDocumentThroughCommand: 2016-08-28 13:32:49 +02:00
Allan Odgaard
24a133d5a5 Add executeBundleCommand:variables: to OakTextView (internal API) 2016-08-28 13:32:48 +02:00
Allan Odgaard
f01bf97630 Add OakCommand responder methods to OakTextView and DocumentController 2016-08-28 13:32:48 +02:00
Allan Odgaard
d142f82f9f Check ‘isRunningCommand’ instead of ‘runner->running()’ 2016-08-28 13:32:48 +02:00
Allan Odgaard
29033c60d8 Use OakCommand in file browser and application delegate 2016-08-28 13:32:48 +02:00
Allan Odgaard
1da89cc5a0 Check for ‘x-txmt’ prefix in URL scheme instead of exact match 2016-08-28 13:32:48 +02:00
Allan Odgaard
f3745fe034 Add new OakCommand framework
A lot of the code is copy/pasted from the document::run implementation, our command::runner and HTMLOutput (custom URL protocol).
2016-08-28 13:32:48 +02:00
Allan Odgaard
974db67258 Read isRunningCommand property instead of looking at URL scheme 2016-08-28 13:32:48 +02:00
Allan Odgaard
bb038b0670 Remove unused HTMLOutputWindow properties 2016-08-28 13:32:48 +02:00
Allan Odgaard
bd61830833 Rework how we find suitable OakHTMLOutputView for command execution 2016-08-28 13:32:48 +02:00
Allan Odgaard
894b33d0bf Set frame autosave name of HTML output windows during creation 2016-08-28 13:32:48 +02:00
Allan Odgaard
fce09a3edf Add mainFrameTitle property to OakHTMLOutputView 2016-08-28 13:32:48 +02:00
Allan Odgaard
b598252c58 Add commandIdentifier property to OakHTMLOutputView 2016-08-28 13:32:48 +02:00
Allan Odgaard
0f90dfd4dd Explicitly set default values for bundle_command_t members 2016-08-28 13:32:48 +02:00
Allan Odgaard
c99e65b17c Let OakHTMLOutputView handle the “Stop Task?” warning sheet
This also allows for the sheet to automatically close, should the command exit before the user selects an action.
2016-08-28 13:32:47 +02:00
Allan Odgaard
2c41cf8fa0 Remove unnecessary code 2016-08-28 13:32:47 +02:00
Allan Odgaard
926786c36c Use NSURLProtocol’s setProperty:forKey:inRequest: for associated data
This simplifies our code though it seems like the lifetime of the data is much longer than the request it is associated with.
2016-08-28 13:32:47 +02:00
Allan Odgaard
0319186e89 Introduce a pipe when writing to the HTML output view
This removes the command::runner_t dependency from our custom URL protocol.
2016-08-28 13:32:47 +02:00
Allan Odgaard
349db77eba Make matched part of search results have a light grey background
The motivation for this was so that we can see if we match whitespace, e.g. searching for trailing whitespace using ‘[\t ]+$’ would not indicate how much whitespace we actually matched.
2016-08-28 13:32:47 +02:00
Allan Odgaard
a4b8abe73c Disable “tightening” of truncated match results
When we tighten the text then it doesn’t line up properly (especially line numbers) which looks off.
2016-08-28 13:32:47 +02:00
Allan Odgaard
817b2dc75e Remove attr_string_t class 2016-08-28 13:32:47 +02:00
Allan Odgaard
7844e50f5b Use string_builder_t instead of attr_string_t
Two minor changes:

- Matches now (correctly) use a font with monospace digits for all line numbers (not just first).
- Matches with ‘\r’ characters now have the replacement string (‘<CR>’) be bold if it is part of the match.
2016-08-28 13:32:47 +02:00
Allan Odgaard
c83e2e80ba Add helper class for building NSAttributedString
The existing ‘attr_string_t’ is a little inflexible in that it has to know how to handle each attribute type and also lack a way to push/pop styles, which means that in practice we have to reset styles when leaving a scope.
2016-08-28 13:30:30 +02:00
Allan Odgaard
b0cbae4353 Update dialog plug-in (HTML tooltip dimension rounding error)
Being off-by-one for the width could cause wrapping adding an entire extra line placed outside the viewport.
2016-08-28 09:56:56 +02:00
Allan Odgaard
5ff520a403 Add move semantics to storage_t 2016-08-28 09:17:59 +02:00
Allan Odgaard
96d322c298 Use close(open(path, O_CREAT)) to “touch” path 2016-08-28 09:16:10 +02:00
Allan Odgaard
b0ba62451d Remove path::touch_tree
This was previously used by the software updater to prevent the “temp cleaner” from removing a downloaded update, incase the user took their time to click the “Install & Relaunch” button.
2016-08-28 09:14:43 +02:00
Allan Odgaard
4294889a79 Add comments about scope attributes 2016-08-28 09:13:41 +02:00
Allan Odgaard
0638874b61 Tag code that can be retired when updating OS requirement
When bumping the minimum requirement we can do a search for MAC_OS_X to find all places where we have compatibility code.
2016-08-28 09:13:33 +02:00
Allan Odgaard
8709ee8f01 Make it obvious that our code is workaround for 10.8 2016-08-28 09:13:27 +02:00
Allan Odgaard
60ba4c9930 Introduce callback.document.will/did-reload 2016-08-28 09:11:34 +02:00