Commit Graph

192 Commits (16382d9574ab380bfab449ab8477ac61a864465f)

Author SHA1 Message Date
Gonçalo Silva 250519f319 Improve gspell_view encapsulation inside TextView 2019-05-04 16:33:09 +01:00
Gonçalo Silva c2d0bde9f8 Replace set_value(X, type(Y)) with set_type(X, Y) for Settings 2019-05-04 16:33:09 +01:00
Gonçalo Silva 939edcc762 Allow disabling scroll sync 2019-05-04 16:33:09 +01:00
Gonçalo Silva db652ef84f Ensure text view is focused when toggling preview
Consistent with other menu options.
2019-05-04 16:33:09 +01:00
Gonçalo Silva a0a19ffbe7 Replace get_value(X).get_Y() with get_Y(X) for Settings 2019-05-04 16:33:09 +01:00
Gonçalo Silva c2a43c374a Remove unused class 2019-05-04 16:33:09 +01:00
Gonçalo Silva e80b61cf9d Work-around for unwanted scroll while resizing the editor
The problem: When a TextView *with vertical margins set* is resized, it
scrolls upwards automatically. It's not entirely clear why this happens,
but removing the top/bottom margins fixes the issue entirely.

The work-around: enforcing the scroll scale between a resize starting
and the UI becoming idle again. This is a hack, and the experience is
not great (the scroll is visibly unstable for a few ms), but it patches
and old bug in UberWriter.

The better solution: Figuring out how to prevent it from happening,
either by somehow ensuring the TextView does not do this, or by
approaching the layout differently where the margin is not set on the
TextView itself.
2019-05-04 16:33:09 +01:00
Gonçalo Silva 7a2e6d5d8f Fix unwanted scroll while resizing the preview 2019-05-04 16:33:09 +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 ebbbd73056 Disable search during full-width preview 2019-05-04 16:33:09 +01:00
Gonçalo Silva 86cffc40ec Improve full-width preview workflow 2019-05-04 16:33:09 +01:00
Gonçalo Silva dc0652e3ed Improve documentation for the new preview 2019-05-04 16:33:09 +01:00
Gonçalo Silva 65e7028843 Add toggle between various preview modes
Including:
* Full-width (original)
* Half-width
* Half-height
* Windowed
2019-05-04 16:33:09 +01:00
Gonçalo Silva f72f61ae7d Fix stats' i18n 2019-05-04 16:33:09 +01:00
Gonçalo Silva 2cb161307c Improve side-by-side experience
Includes multiple improvements to scroll syncing, preview re-render,
layout separation, etc
2019-05-04 16:33:09 +01:00
Gonçalo Silva 5e770510ee Add support for side-by-side preview
Fixes #59
2019-05-04 16:33:09 +01:00
Gonçalo Silva bc23fa9b0b Make characters-per-line configurable
This is in preparation for the side-by-side preview, where the editor
needs to become more adaptable. It indirectly fixes #141, as users can
now change the desired line-length, although there is no UI setting for
it.
2019-05-04 16:33:09 +01:00
Gonçalo Silva 562cc7e200 Sync scroll between text view and web view
Scrolling is synced via scroll percentage. This works for most cases,
but breaks down on very large or complex documents. It is consistent
with the approach other editors use (eg. iA Writer), but in the future
we should explore alternatives that don't incur in edge cases.

The syncing itself is done via JavaScript. It could be argued that a
`WebExtension` is the better approach, but it is considerably more
complex for such a simple use case and it would be painful to implement
until UberWriter's build system is updated, since it requires
implementing a C extension.

Fixes #55
2019-05-04 16:33:09 +01:00
somas95 b9e2720eed
Merge pull request #159 from goncalossilva/fix.markup
Small markup fixes
2019-05-04 14:18:12 +02:00
Manuel Genovés 249e78c746 Migrate to gspell 2019-05-04 14:11:23 +02:00
Gonçalo Silva 241ba567e4 Fix character count with horizontal rules
Pandoc's conversion to plain text converts horizontal rules to a
sequence of 72 dashes. This update ensures that subsequent dashes
are ignored when counting characters.
2019-05-01 19:04:50 +01:00
Gonçalo Silva 9238a82d4d Fix #154 2019-05-01 19:04:27 +01:00
somas95 dc80c6763a
Merge pull request #158 from UberWriter/flatpak-improvements
Flatpak improvements
2019-05-01 16:50:15 +02:00
Christopher Davis e0cea3654a Migrate to gspell
gtkspellcheck is abandoned; Use gspell instead.

Closes https://github.com/UberWriter/uberwriter/issues/93
2019-04-28 23:03:10 -04:00
Gonçalo Silva ddcf76df47 Set text view padding in Python instead of CSS
Otherwise scrolling calculations will be slightly offset, as the CSS
padding is added *on top* of any other margin.
2019-04-21 01:50:49 +01:00
Gonçalo Silva 81f9104d9f Split gtk and web CSS into separate directories
Helps clean up the CSS selection on the export dialog, as only Web CSS
is useful in that scenario.
2019-04-21 01:50:49 +01:00
Gonçalo Silva e87de1424e Remove hard-coding from Gtk-related CSS
It's unecessary, since Adwaita and most popular themes provide a defined
set of public colors.

For reference, see: https://github.com/GNOME/gtk/blob/master/gtk/theme/Adwaita/_colors-public.scss
2019-04-21 01:32:26 +01:00
Manuel Genovés 3d26dc2b25 flatpak improvements 2019-04-20 18:24:21 +02:00
Ryan Gonzalez 32bb70a261 Flatpak fixes (ref. #111) 2019-04-19 13:06:13 -05:00
Gonçalo Silva dccc645430 Add paragraphs stat 2019-04-19 11:26:21 +01:00
Gonçalo Silva c19f57f64b Add statistics for sentences and read time, allow user to toggle default
Fixes #63
2019-04-19 11:23:16 +01:00
Gonçalo Silva 1a7443fd3c Switch to a more powerful and accurate stats counter
The new stats counter is able to count characters, words, sentences, and
reading time.

It does so more accurately than before, by leveraging Pandoc's plain
format, and a few simple regular expressions that besides accuracy, also
improve support for Asian languages. It's all done on a background
thread to avoid hogging the UI.
2019-04-19 11:23:16 +01:00
Gonçalo Silva f6c62fb459 Tooltip capitalization fix 2019-04-19 11:23:16 +01:00
Gonçalo Silva dfe7cc420e Fix opening recents popover affecting font size 2019-04-19 00:00:33 +01:00
Gonçalo Silva 567e74c99e Fix active search going out of bounds 2019-04-17 02:15:59 +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 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