Commit Graph

484 Commits (ft.font-size)
 

Author SHA1 Message Date
somas95 f5d7f518fa
Merge pull request #143 from goncalossilva/various_improvements
This PR includes various fixes and improvements, most of which I discussed with @somas95 a couple of weeks ago. It also includes some refactoring, mainly to improve encapsulation.

Fixes #17  
Fixes #75 
Fixes #90 
Fixes #120
Fixes #122

Some considerations/questions follow.

**Commit messages**
I recommend reviewing each commit message carefully, as they explain the thinking behind each change. Not everything is small or linear, and hopefully the commit message explains the background and reasoning properly. If anything is missing, I'm happy to try to explain.

**Translations**
There are a few capitalization/copy fixes. I am unsure how this affects translations, or if there's any work I can to make the transition easier. For instance, how are the po files updated?

**Styling**
Styling is subjective, and although I claim to address #90, it's important to note that I'm a fan of UberWriter's simplistic style, reminiscent of iA Writer's approach. As such, I didn't introduce any sizing nor color changes, as I don't personally agree with this direction. Instead, the changes are subtle:
* For links, the link/syntax part is greyed out, without any further changes
* For code blocks, they are indented similarly to quotations, without any further changes

**UI changes**
There are (very minor) UI changes within the places that were touched, mainly preferences and the export dialog. Most of these are around improving small things, such as spacing (eg. multiples of 8), slightly broken alignments, etc.

The only exception would be the removal of ODT as one of the export options in the top bar. As before, subjective, but I find that a sub-window's top bar with 6 horizontal buttons is a little overwhelming, and considering that ODT is still available within the advanced tab, I propose that we remove it as a default option and have a more balanced top bar. I am assuming that PDF/HTML are the most used, but please let me know if that's not the case.

**Further work**
I have a few more tasks planned for the upcoming weeks, hopefully built on top of this codebase as it makes some of them much easier. [Here's a screenshot of my Todoist.](https://cl.ly/4160755d210d/gnome-shell-screenshot-3MMO0Z.png) Hopefully this helps knowing what to expect. 😊
2019-04-17 20:44:18 +02:00
Gonçalo Silva 432ef9d55e Set tooltips on the whole button, not just the icon 2019-04-17 02:54:55 +01:00
Gonçalo Silva 53d3fc6026 Use symbolic icon for input format documentation 2019-04-17 02:52:56 +01:00
Gonçalo Silva 567e74c99e Fix active search going out of bounds 2019-04-17 02:15:59 +01:00
Gonçalo Silva fc824fc2ef Add missing tooltip for search's regular expression option 2019-04-17 02:13:00 +01:00
Gonçalo Silva d98208e0e9 Cleanup left-over from removing ODT as a default export option 2019-04-17 02:10:19 +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 c9958b6c12 Prevent exception when exiting while waiting for scroll 2019-04-16 01:15:11 +01:00
Gonçalo Silva 41377c24bb Further remove unecessary prefixes 2019-04-15 03:01:59 +01:00
Gonçalo Silva 9f41bfac8d Add input format setting
Supports Pandoc's Markdown, Commonmark, GitHub Flavored Markdown,
MultiMarkdown and Plain Markdown.

Fixes #17
Fixes #122
2019-04-15 02:50:28 +01:00
Gonçalo Silva ce4a13278d Organize export formats by type, more copy fixes 2019-04-15 02:50:28 +01:00
Gonçalo Silva 351f7834a5 Remove ODT as default export option
Subjective, but a sub-window with 6 buttons on the top row is crowdy.
2019-04-15 02:50:28 +01:00
Gonçalo Silva 0c94f0c168 Fix padding/margins in export dialog UI 2019-04-15 02:50:28 +01:00
Gonçalo Silva 13ea2cc8fe Make advanced options match defaults, fix capitalization/typos
Having advanced options match defaults helps as a self-documenting
reference.
2019-04-15 02:50:14 +01:00
Gonçalo Silva 13535ab839 Delete unused UI files 2019-04-15 02:50:14 +01:00
Gonçalo Silva fbef0143e2 Use correct mime type for markdown, split markdown/plain text 2019-04-15 02:50:14 +01:00
Gonçalo Silva 4b32617ca7 Update pandoc help link 2019-04-15 02:50:14 +01:00
Gonçalo Silva 50729b0d34 Introduce pypandoc for pandoc calls 2019-04-15 02:50:05 +01:00
Gonçalo Silva 1842a849ad Fix warning due to missing argument 2019-04-13 03:45:27 +01:00
Gonçalo Silva af9d1adf7c Uniformize header/status bar reveal duration 2019-04-13 03:45:09 +01:00
Gonçalo Silva 58e2d2e0be Remove uneeded threads_init calls 2019-04-13 02:47:26 +01:00
Gonçalo Silva ef54c752ba Fix replace row missing after hiding
The replace row would be consistently missing after losing focus
(ie. hiding), and would be inconsistent with the button state.
2019-04-13 02:45:21 +01:00
Gonçalo Silva 5be563ccc7 Fix search and replace
TextIter must not be reused in between buffer changes. This resulted in
unpredictable behavior when using search and replace. For instance,
in the following string:

This _is_ a _test_ of _search_ and _replace_

Searching for "_" and replacing with "**" sequentially would:

[0] This **is_ a _test_
[1] This ****is a _test_
[2] This ****is a **test_
[2] This ****is a ****test

Replace had similar results.
2019-04-13 02:45:15 +01:00
Gonçalo Silva ac7e18b0b3 Improve auto-scrolling after pasting very large documents
There were 2 problems.

When pasting very large documents, the height calculations will be
temporarily incorrect while the content is rendered over several frames.
This is addressed by waiting for the UI to be idle to scroll.

Additionally, the scroll time (typically 200ms) needs an adjustment as
well. Starting at 200ms, it now scales linearly with distance, amounting
to roughly 4 seconds with Pandoc's user guide.
2019-04-13 02:00:13 +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 c5d2322b96 Fix cursor position changes not scrolling in focus mode 2019-04-13 02:00:13 +01:00
Gonçalo Silva 372d2c8a65 Remove tick callback after scrolling is done
Adding a tick callback starts updating the frame clock:
d1cdb9b5cf/gtk/gtkwidget.c (L3629)

Gdk's documentation implies that this is taxing, as it continuously
requests a new frame (which makes sense, this API is for animations):
https://developer.gnome.org/gdk3/stable/GdkFrameClock.html#gdk-frame-clock-begin-updating

Most likely fixes #75
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
Gonçalo Silva 16a8ac78db Fix changing theme while app is running not applying until restart
Overall refactoring of how the theme is set, bounding it to the window
instead of the application, which generally makes it easier to listen
for the "style-updated" signal.
2019-04-11 05:23:34 +01:00
Gonçalo Silva 99641125ba Uniformize main class <> file naming 2019-04-11 03:49:59 +01:00
Gonçalo Silva 30df10cab6 Allow following system theme *and* forcing light / dark theme 2019-04-11 03:42:15 +01:00
Gonçalo Silva 7a9b878d02 Copy improvements
Smaller improvements around capitalization, tense and style.
2019-04-11 03:42:15 +01:00
somas95 cada4f6702
Merge pull request #138 from UberWriter/ft.shortcutfixes
Ft.shortcutfixes
2019-04-06 20:38:39 +02:00
Manuel Genovés 30649551b6 Fix and improve shortcuts 2019-04-06 20:32:48 +02:00
Manuel Genovés 23c1b2e42a Fix and improve shortcuts 2019-04-06 20:27:42 +02:00
Manuel Genovés 80270a45ee Fix and improve shortcuts 2019-04-06 20:19:53 +02:00
Wolf Vollprecht 72760ad7d1
Merge pull request #132 from UberWriter/ft.tidying
Tidy up UberWriter
2019-04-05 10:00:19 +02:00
Manuel Genovés 129041795a use pep8 naming style for modules and classes 2019-04-01 22:40:59 +02:00
Manuel Genovés c91d8018dc moving files to better suited folders 2019-04-01 21:29:29 +02:00
Manuel Genovés 258000b300 remove unneeded files 2019-04-01 18:06:57 +02:00
Manuel Genovés d19068bc2c move all modules to /uberwriter 2019-04-01 18:00:17 +02:00
somas95 0097ba667e
Merge pull request #129 from UberWriter/styles
A lot of improvements made by @goncalossilva:

    Fix #112
    Improve the themes support:
        Clean all the CSS involved
        Encapsulate theme handling
        Reload preview when theme changes
        Fix fonts on the preview mode
        Add support for high contrast themes
    Add Hemingway mode
2019-04-01 16:48:01 +02:00
somas95 97fd6d62b4
Merge pull request #128 from goncalossilva/ft.hemingway
Adds Hemingway Mode
2019-03-28 20:18:42 +01:00
Gonçalo Silva 3f87bd1d22 Add Hemingway Mode
Closes #40
2019-03-27 02:29:29 +00:00
Manuel Genovés 6d7bfe82cb unclutter the terminal output 2019-03-26 22:02:05 +01:00
somas95 fc0c68f41c
Merge pull request #127 from goncalossilva/styles
Preview improvements
2019-03-26 20:25:22 +01:00
Gonçalo Silva bef52648c7 Remove hard-coded colors from MarkupBuffer
Instead, use colors set in the theme.
2019-03-26 15:09:21 +00:00
Gonçalo Silva 152db98f8a Add script used to generate theme colors
Theme colors are originally based on GitHub's theme.

This script (slightly) offsets them to match the color pallete of the
specified theme automatically, and prints them out.

While the adjustments are meant to be minor, color contrast should still
be verified.

Finally, a few themes should not be automated in this way. For example,
the high contrast themes are meant to be purely black & white.
2019-03-26 15:09:21 +00:00
Gonçalo Silva 95e6d89514 Add support for HighContrast and HighContrastInverse themes 2019-03-26 15:09:21 +00:00