Commit Graph

55 Commits

Author SHA1 Message Date
Darren Burns
bbde62fc57 Text area (#2931)
* Add docstring and switch to tree-sitter-languages wheels - although the wheels arent working

* Adding highlights files

* Fix index error on SyntaxAwareDocument

* Narrowing highlighting scope

* Adding basic highlights for Markdown

* Using utf-8 byte length instead of codepoint count in syntax aware doc

* Start creating an ABC defining functionality required by Document impls

* Simplify tree-sitter logic

* Extracting more ABC

* Fix width calculation, add SyntaxTheme

* Ensure the highlight line style goes right to the very end

* Updating a docstring

* Renaming, and adding document width guide

* Ensuring that line number column toggling refreshes virtual size

* Ensuring that line number column toggling refreshes virtual size

* Width guide

* Fix focus event stopping

* Use release_mouse

* Improving a docstring

* Remove bash

* TextArea language snapshot testing

* Updating snapshots for TextArea since we now highlight more nodes

* Typing fixes

* Testing

* Adding tests

* Fixing language selection

* Refresh size on indent width change

* Testing, renaming, fixing display of selection

* Fix multibyte highlight glitch

* Fix deleting right with selection at end of document in TextArea

* Fixing utf-8 multibyte character issues

* Default location of text insertion is cursor position, add cursor_location properties

* Removing some debugging code

* Cursor location tests

* Updating snapshots

* Cached utf8 encoding

* TextArea selection snapshot testing

* Tidying docstrings and queries

* Updating selection snapshot output

* Binding for ESC to shift focus

* Only build the tree-sitter query once!

* Expand cursor scroll horizontal leeway in TextArea

* Property setter for cursor_location in TextArea shouldnt return value

* Avoiding NamedTuple subclassing - using type aliasing instead

* Tidying API, docstrings etc.

* Tidying the API and docstrings

* TextArea additional cursor tests

* Testing pageup and pagedown in TextArea

* Fix a faulty test

* Docstring in a test for TextArea edit

* Stop using DEFAULT_SYNTAX_THEME

* Docstrings

* Change cursor_destination to move_cursor, add more tests

* Remove faulty assertion

* Tidying cursor movement

* Tidying up, adding docstrings for component classes

* Fix a broken selection test

* Remove some unused highlighting machinery

* Fix some Python highlighting issues

* Make HTML syntax highlight nicely

* Create tag name for mismatching HTML end tag

* Add styling for YAML, update boolean styling

* Stylising toml types

* Styling floats

* JSON syntax highlighting

* Updating snapshots

* Syntax highlighting datetimes in TOML

* Namespace TOML errors in highlighting

* Add a move_cursor_relative method

* Update TOML TextArea snapshot for datetime highlighting support

* Adjusting selections

* At TextArea widget level, delete_range is insert_range of empty string

* Refactoring

* Dunder all, docstring fix

* Fix XFAIL

* Remove unused import

* More tests, tidying up

* Cleaning the API

* Docstrings for TextArea

* A bunch of docstrings, delete unused code

* More tidying and docstrings

* Cursor origin on document load, correctly handle delete word left/right when selection is non-empty, fix delete_line when selection spans multiple lines and is in reverse direction

* Moving things around

* Fixing dunder all to export DocumentBase

* Add docstring

* Record cursor width on programmatic insert since it can result in the cursor moving

* Typing fixes

* Fixing remaining typing issues with TextArea

* Add tree-sitter-languages stubs and fix typing issues in documents

* Fixing remaining typing issues with document

* Updating Syntax themes

* Improve highlighting, add initial TextArea docs page

* Add TextArea indent note

* Start TextArea guide inside reference

* Add TextArea to widget gallery

* Fleshing out TextArea docs

* Add note

* Fix TextArea programmatic insert/cursor interaction

* Improve a test

* Testing replacement within selection

* Testing double-width character keyboard navigation and deletion keybinds with active selections

* Testing "delete to start of line" TextArea binding

* Testing TextArea delete line methods and delete to end of line

* Testing shift selecting using keyboard in vertical direction

* Expand tests for home and end keybinds in TextArea

* Renaming tests, testing empty replace and insert

* Testing delete word left via API

* Testing delete word left via API

* Testing delete_word_left with tabs, and delete_word_right

* Remove unused variables

* Remove debugging width guide

* Fix snapshot report path

* Deleting word left/right interaction with line ends fixes, ensure cursor width recorded on all edits

* Docstring fixes

* Unpin textual snapshot library dependency (issue is fixed)

* Docstring fixes

* Fix recording cursor width

* Fix a docstring

* Add select_all to TextArea

* Remove unused tree-sitter stuff from .gitignore

* Line select

* Make word pattern private in TextArea

* Add blinking cursor to TextArea

* Renaming, adding missing return typing

* Add selection bindings

* Moving cursor left/right by word while selecting

* Change escape keybind description, TextArea

* Stripping whitespace when going word left/right

* Add missing annotation

* Cursor word right and left parity with PyCharm

* Use repaint=False for cursor blink

* Improve focus/blur styling

* A whole bunch of TextArea testing

* Simplify delete_left and delete_right

* Testing hiding line numbers in snapshot

* Adding snapshot test for unfocus styling

* Create initial snapshot for text-area unfocused

* Support shift+home, shift+end

* Document shift+home, shift+end

* Add Dracula syntax highlighting theme

* Small change to delete_line behaviour when multiple lines selected to match vscode/pycharm behaviour

* Add test for new delete line logic

* Delete line improvement

* Add extra test for delete_line multiple selection

* Test cursor "smart" home behaviour

* Fix typo

* Highlight matching brackets

* Update snapshot

* Update snapshot

* Fix xfails

* Simplify delete_word_left

* Catch correct exception to ensure support for Python 3.7

* Add styling for Markdown

* Add styles for Dracula for Markdown

* Remove unused _fix_direction.py

* Add docstring to EditResult

* Use default=0 in max inside Document

* Remove redundant actions

* Use cell-width aware expand tabs implementation from @willmcgugan

* Construct strip with cell length

* Some TextArea keyword-only arguments

* Begin moving over to TextAreaTheme #skipci

* Prepare queries inside document #skip-ci

* Add comment

* Refactoring

* TextAreaTheme styling

* Setting width of blank selected lines

* Building the highlight map in the text area

* Remove unused default css from TextArea

* Moving highlighting stylize into widget

* Moving syntax highlighting into TextArea widget

* Remove unused code

* Optimise imports

* Fix highlighting when initial text supplied to TextArea

* Rebuild highlight map when the theme changes

* Extending

* Restore themes

* Remove old comment, fix docstring

* Fixing docstrings

* Fixing mypy

* Fixing mypy issues in document

* Tidying things

* Updating version

* Add theme

* Fix VSCode theme bracket matching

* Only match brackets when theres no selection

* Highlighting tidying

* Fix markdown header highlighting

* Setting theme correctly in background

* Tidying module interface

* Merging main

* Fixing a bunch of typing problems

* Fixing more typing problems

* Correctly setting theme object

* mypy

* Small fix to bracket matching

* Improve a docstring

* Fix docstring

* Testing builtin and custom languages

* Unit testing theme stuff

* Reworking themes

* Error handling

* Improve error message

* Testing new theme setting approach, error handling

* Improvements/tests for theme and language setting

* Remove unused TextArea unfocus snapshot

* Update snapshot file

* Adding theme snapshot tests

* Add `function.call` style binding in dark vscode theme

* Renaming a test file

* Making active line clearer on vscode theme

* Renaming tests

* A whole lot of docs for TextArea

* Update wording in docs

* A bit more docs

* Example on adding Java as a custom language

* More custom language docs

* Finishing up custom themeing/syntax highlighting guide for TextArea

* Add note on potential issue

* Fix wording

* Add note on Apple Silicon Python 3.7 fallback

* Add another note on Apple Silicon Python 3.7 fallback

* Fix class names in example files

* Add some documentation for useful TextArea APIs

* TextArea docs improvements

* TextArea docs typo fix

* Note about extending TextArea

* Tab-stop support when spaces used for indent

* Docs update

* Text area blog post (#3356)

* Start blog post

* Add demo script to blog post

* Continuing the blog post

* Yet more writing for TextArea blog post

* Working on closing section

* Finishing up

* Update docs/blog/posts/text-area-learnings.md

Co-authored-by: Dave Pearson <davep@davep.org>

* Update docs/blog/posts/text-area-learnings.md

Co-authored-by: Dave Pearson <davep@davep.org>

* Typo fix

* Update docs/blog/posts/text-area-learnings.md

Co-authored-by: Dave Pearson <davep@davep.org>

---------

Co-authored-by: Dave Pearson <davep@davep.org>

* Remove redundant pass

* Add docstring

* Docs fix

* Simplify docs

* Improve docstring

* Add links in docstrings

---------

Co-authored-by: Dave Pearson <davep@davep.org>
2023-09-21 11:10:14 +01:00
Darren Burns
74aa90f5ac Add Python 3.12 to CI suite (#3255) 2023-09-10 14:58:33 +01:00
Will McGugan
65e81c58be Textual dev (#2884)
* WiP: Move the devtools and related code to `textual-dev` (#2834)

* Remove the textual script from the project file

This is moving into the textual-dev package.

* Remove the textual CLI code from Textual

This has all gone to live in textual-dev.

* Remove the devtools testing from Textual's unit tests

They've moved over to textual-dev instead.

* Remove the devtools server from Textual itself

The start of the process to remove as much of the core devtools as possible
from Textual.

* Switch the console docs example screenshot over to textual_dev

* Remove rednerables.py from Textual

* Remove the last parts of devtools from Textual

This is the last step. It remains to be seen if this is sustainable, but for
testing purposes this is the extreme case we're aiming for. I *think* this
will work though.

Hereon we'll be needing to do an editable install of textual-dev into
textual, and more generally and once this is "live" we'll be needing to make
sure that textual[dev] is installed when doing development work on textual
apps.

The thing that remains to be seen however is how this all works
with *developing* Textual itself. Will I always need to do an editable
install? Still got to figure that one out.

* Start to whittle down the pyproject file

The next step is to try and work out what can come out of the pyproject
file.

* Remove aiohttp from Textual

* Remove some more development dependencies we don't need any more

* Relock

* Remove the pointer to the previews directory

* Reintroduce the border preview snapshot test

* Reintroduce the color preview snapshot test

* Reinstate the key press for the border preview snapshot test

* Reintroduce the easing preview snapshot test

* Reintroduce the keys tool snapshot test

* Add pytest-asyncio as a development dependency

* Relock

* Pin the textual-dev version to 0.1.0 or later

Mostly to try and get the tests kicked off properly.

* Relock dependencies

* Further `textual-dev` changes (#2850)

* Remove the textual script from the project file

This is moving into the textual-dev package.

* Remove the textual CLI code from Textual

This has all gone to live in textual-dev.

* Remove the devtools testing from Textual's unit tests

They've moved over to textual-dev instead.

* Remove the devtools server from Textual itself

The start of the process to remove as much of the core devtools as possible
from Textual.

* Switch the console docs example screenshot over to textual_dev

* Remove rednerables.py from Textual

* Remove the last parts of devtools from Textual

This is the last step. It remains to be seen if this is sustainable, but for
testing purposes this is the extreme case we're aiming for. I *think* this
will work though.

Hereon we'll be needing to do an editable install of textual-dev into
textual, and more generally and once this is "live" we'll be needing to make
sure that textual[dev] is installed when doing development work on textual
apps.

The thing that remains to be seen however is how this all works
with *developing* Textual itself. Will I always need to do an editable
install? Still got to figure that one out.

* Start to whittle down the pyproject file

The next step is to try and work out what can come out of the pyproject
file.

* Remove aiohttp from Textual

* Remove some more development dependencies we don't need any more

* Relock

* Remove the pointer to the previews directory

* Reintroduce the border preview snapshot test

* Reintroduce the color preview snapshot test

* Reinstate the key press for the border preview snapshot test

* Reintroduce the easing preview snapshot test

* Reintroduce the keys tool snapshot test

* Add pytest-asyncio as a development dependency

* Relock

* Pin the textual-dev version to 0.1.0 or later

Mostly to try and get the tests kicked off properly.

* Relock dependencies

* Whitespace cleaning

* Swap mentions of textual[dev] to textual-dev

* Remove the dev extra

* Tweak README.md in response to PR review

* Tweak animation.md in response to PR review

* Tweak getting_started.md in response to PR review

* bump version

* lock

* drop dev

* more

* version bump

---------

Co-authored-by: Dave Pearson <davep@davep.org>
2023-07-03 15:37:40 +01:00
Jorge
e4523127a9 Add CodeQL workflow (#2882) 2023-07-03 14:17:16 +01:00
Rodrigo Girão Serrão
a9a04dc37a Run workflows when they are changed.
Related comments: https://github.com/Textualize/textual/pull/2577\#issuecomment-1549411724
2023-05-16 11:43:31 +01:00
Rodrigo Girão Serrão
9b09b19e5f Update workflows.
This caches the virtual environment so we don't have to download it every time (the cache can be cleared from the repository > Actions > Caches (on the left).

We also split black formatting into a separate workflow.
This means we can run black ONLY when *.py files are changed.
It also means all other testing jobs don't need to _also_ check formatting.
2023-05-16 10:18:30 +01:00
Dave Pearson
9dda90ea75 Extend testing to some more files
In this case the snapshot data, the lock file and the Makefile.
2023-05-02 13:07:47 +01:00
Dave Pearson
a8d2724873 Attempt to narrow CI/test trigger to just code changes
Looking at
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
I *think* this might be the approach to take. Consider this an experimental
change that will very likely get rolled back.

See #2404
2023-05-02 12:52:51 +01:00
Will McGugan
832d191bd3 bump poetry (#2447) 2023-05-01 15:35:58 +01:00
Will McGugan
80ae6ce4d9 Update task.md 2023-02-27 16:19:31 +00:00
Rodrigo Girão Serrão
94157eae59 Skip FAQtory on new issues by Textualize members
Fix #1617 (excellent idea).
2023-01-20 15:47:13 +00:00
Will McGugan
c6909b76c4 update bug report template 2023-01-19 14:50:30 +00:00
Dave Pearson
01e6ae43d0 Sanitise issue titles before running suggest on them
Applying
https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
to #1472.
2023-01-06 06:43:41 +00:00
Will McGugan
c20bf664e8 Update bug_report.md 2022-12-18 10:22:36 +00:00
Will McGugan
3cfebb0423 Added faqtory 2022-12-18 09:50:44 +00:00
Will McGugan
fd61ca69a4 Update comment.yml 2022-11-16 17:02:50 +00:00
Will McGugan
9fd1e7605a Create PULL_REQUEST_TEMPLATE.md 2022-11-15 14:58:38 +00:00
Will McGugan
0fb2c3437f remove hatch from CI 2022-11-07 16:41:30 +00:00
Ofek Lev
cd9ea54329 Update package metadata and dev experience 2022-11-07 12:02:54 +00:00
Will McGugan
7b31f63202 Merge pull request #1016 from Textualize/python311
Add Python 3.11 to CI, update install-poetry action
2022-10-31 13:23:12 +00:00
Will McGugan
acda0fa8af update snok install poetry 2022-10-31 11:45:01 +00:00
Will McGugan
02c947985e bump poetry 2022-10-31 11:43:24 +00:00
Will McGugan
3e7a42751d Update bug_report.md 2022-10-28 09:51:22 +01:00
Darren Burns
ceed9186c9 Python 3.11 CI 2022-10-27 10:44:06 +01:00
Darren Burns
5933cbb7e8 Revert build action to 3.11-rc.2 until Darwin build ready 2022-10-25 15:38:54 +01:00
Darren Burns
7599accccf Fix GitHub action install-poetry version 2022-10-25 15:36:22 +01:00
Darren Burns
91b2e03d65 Add Python 3.11 to CI, update install-poetry action 2022-10-25 15:32:50 +01:00
Will McGugan
2a3eed1379 No more ko-fi 2022-10-25 10:22:35 +01:00
Will McGugan
2a351c0ff6 merged 'main' into css 2022-10-22 18:48:46 +01:00
Darren Burns
e090931d21 Remove E2E smoke test from workflow 2022-10-13 12:55:50 +01:00
Darren Burns
49abcbadfe Upload snapshot report when build fails 2022-09-20 17:05:43 +01:00
Darren Burns
8e09c0271a Adding windows snapshot testing conditional on github actions 2022-09-20 16:44:32 +01:00
Darren Burns
26fb89005c Skip artifact creation/upload on Windows 2022-09-20 16:44:18 +01:00
darrenburns
c788724754 Make devtools deps extras, add note to internal ref docs, raise excep… (#579)
* Make devtools deps extras, add note to internal ref docs, raise exception when deps missing

* Ensure dev extras are installed in GitHub Actions

* Update lockfile

* Add extra docs note

* Add a TODO about adding link to devtools docs

* Add click to dev extras dependencies in pyproject
2022-06-15 11:49:52 +01:00
Will McGugan
66fabe00db Merge pull request #464 from Textualize/windows-ci
Windows CI
2022-05-04 13:38:13 +01:00
Darren Burns
516f551c36 Remove codecov from Textual 2022-05-04 12:37:43 +01:00
Darren Burns
d73b8618c1 Add windows-latest to GitHub Actions build matrix 2022-05-04 11:16:54 +01:00
Darren Burns
01815c7788 Merge branch 'css' of github.com:Textualize/textual into py10-ci 2022-05-04 11:10:47 +01:00
Darren Burns
ca65dc3f8c Add Python 3.10 to GitHub actions, upgrade mypy 2022-05-04 11:09:57 +01:00
Olivier Philippon
078b7c151b [e2e] The smoke tests no longer rely on the multiprocessing package
Running the scripts with this package leads to the following cryptic error in our CI, when run in macOS:
```
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
```
(and Python's docs clearly state that this `freeze_support` function has no effect when invoked on any operating system other than Windows ¯\_(ツ)_/¯ )
2022-05-03 14:45:48 +01:00
Olivier Philippon
85db9263a8 [e2e] Move the smoke tests to a new root folder "e2e_tests/" 2022-05-03 14:45:48 +01:00
Olivier Philippon
4bc48d37a1 [CI] Check that the "basic.py" sandbox script can be run for a few seconds without crashing 2022-05-03 14:45:48 +01:00
Will McGugan
38efc82173 Update comment.yml 2022-02-15 13:30:23 +00:00
Will McGugan
f87a7066dd Update comment.yml 2022-02-15 13:28:59 +00:00
Will McGugan
95ed0c85df Update FUNDING.yml 2022-02-15 13:22:21 +00:00
Will McGugan
6688d0bf36 Merge pull request #90 from willmcgugan/layout-plus
Layout plus
2021-09-05 09:03:06 +01:00
Will McGugan
d2b4866afc Rename task to task.md 2021-09-04 10:19:28 +01:00
Will McGugan
a90d8036c9 Create task 2021-09-04 10:18:51 +01:00
Will McGugan
3f28a36028 end of file 2021-08-31 17:34:19 +01:00
Will McGugan
c32c48375d Create FUNDING.yml 2021-08-07 12:06:41 +01:00