Commit Graph

16 Commits (github/fork/sternenseemann/patch-1)

Author SHA1 Message Date
Thomas Lavend'Homme 2abb2af472
Impove regex for emphasis 2019-12-22 10:06:35 -05:00
Gonçalo Silva 128ce54761 Handle inline code correctly
Inline code shouldn't have its "paragraph-background" set, as it's not a
block-level element.
2019-07-25 00:18:33 +01:00
Gonçalo Silva 05cdfe0599 Use CommonMark's regexp for autolink / autoemail
Ref: https://github.com/commonmark/commonmark.js/blob/master/lib/inlines.js#L62-L64

Also avoids special handling in stats counter.
2019-07-25 00:18:33 +01:00
Manuel Genovés 300c386631 Added handling of alternate form of urls 2019-07-25 00:18:33 +01:00
Gonçalo Silva 7ea8f67216 Add code highlighting
Removes previously added indent. Reused for math.
2019-07-25 00:18:33 +01:00
Gonçalo Silva 931d92bdfd Move markup to a worker process
A worker thread works in practice, but the GIL takes a significant toll
as the code is computationally heavy. The result is a hogged UI,
specially when other threads are involved (eg. stats counter).

A worker process is faster, hogs the UI significantly less, at the cost
of slightly higher memory usage.

As side-effects:
- UberWriter can now comfortably handle much larger documents
- Text selection is much more responsive
2019-07-25 00:16:26 +01:00
Gonçalo Silva 0b13fdddc5 Remove unused offset in markup handler 2019-07-25 00:16:26 +01:00
Gonçalo Silva 8e97b7ae2c Quality of life improvements for regexp
Includes:
* Moving them into an independent file
* Using named groups for clarity
* Support for multi-line list items
* Better handling of block markup at start / end of document (eg. hr)
* Better handling of the separation around block items (eg. space around a list)
2019-07-25 00:16:26 +01:00
Manuel Genovés 213ff104e5 Update license 2019-07-05 20:47:49 +02:00
Gonçalo Silva 828f4b0bf1
Remove unused NUMERICLIST 2019-05-22 19:30:36 +01:00
Gonçalo Silva 7ff1df4371 Optimize markup update on margin/indent change
Updating text tags is expensive, so avoid it unless necessary.

A place where this was felt was when pasting large text.
2019-05-04 16:33:09 +01:00
Gonçalo Silva 9238a82d4d Fix #154 2019-05-01 19:04:27 +01:00
Gonçalo Silva 8159ad9e25 Tweak breakpoints to ensure it conforms to the documented spec 2019-04-17 02:07:15 +01:00
Gonçalo Silva bf657891c6 Add link markup
Fixes #90
2019-04-13 02:00:13 +01:00
Gonçalo Silva 86c924972b Add support for code blocks, improve overall markup handling
This commit adds markup support for code blocks, styling them in a
conservative manner, similar to blockquotes, solely indenting them.

Partially fixes #90

Code-wise, this means marking up around the cursor becomes exponentially
more complex, as a change in one line can affect multiple lines. Solving
it is non-trivial, so the whole document is always marked up.

Marking up the whole document is irrelevant for small to medium
documents, but can incur in a performance penalty for
very large documents (empirical testing: 1M characters takes ~0.15s).
To alleviate this, GLib.idle_add is used to ensure that markup is only
parsed and applied when the UI is idle. Again, small to medium-sized
documents see no difference. For very large documents, markup will be
slightly delayed to allow for a fluid typing experience.

It's important to note that the previous flows frequently used full
document markup: paste, focus mode, and search and replace.
In some extreme cases, doubly parsing (eg. paste + text change).
For very large documents, doing any of these actions would freeze the UI
unconditionally, so in more ways than one this is an upgrade.

Lastly, it's a little overzealous: with over 1M characters the UI itself
struggles more than parsing.

In sum:
* Markup is always applied to the whole document
* The code is simpler
* There is never double work
* Markup is applied when the UI is idle, for a more smooth experience
* Multi-line formatting is now possible to do reliably
2019-04-13 02:00:13 +01:00
Gonçalo Silva 6688eb259e Refactor textview / textbuffer into separate modules
Changes include:
* Much better encapsulation of textview/textbuffer, with each isolated
responsibility living independently on its own class/file.
* Less code overall
* Various small fixes around the components involved, such as:
  * Indentation of nested lists (fixes #120)
  * Unwanted scroll on select all (ctrl+a)
* Removal of unused code around the components involved
* Fixes for scrollbar location, now at the edge of the window
2019-04-13 02:00:13 +01:00