369 Commits

Author SHA1 Message Date
Will McGugan
cac897f6f3 bump 2024-02-01 10:06:09 +00:00
Will McGugan
7e27a3364f reactive fix 2024-01-31 15:47:13 +00:00
Will McGugan
5fa128e08e pin black 2024-01-29 17:13:20 +00:00
Darren Burns
32ea6ec2c0 Update Rich 2024-01-18 13:29:09 +00:00
Darren Burns
b219733fd5 Merge branch 'main' of github.com:Textualize/textual into text-area-wrapping-widget-changes 2024-01-08 15:02:51 +00:00
Will McGugan
60b8074e68 fix for specificity (#3963)
* fix for specificity

* changelog

* docstrings
2024-01-05 11:34:46 +00:00
Will McGugan
b7f998a8a5 bump version (#3956) 2024-01-04 15:19:12 +00:00
Darren Burns
fbeabd518d Fix an off by one 2024-01-03 15:51:55 +00:00
Will McGugan
1c8dc5d74e bump 0.46 (#3891) 2023-12-17 20:17:20 +00:00
Rodrigo Girão Serrão
49e7186268 Merge pull request #3845 from branchvincent/importlib-metadata
drop importlib-metadata
2023-12-14 12:06:43 +00:00
Rodrigo Girão Serrão
e1b94e4b66 Add 3.12 to CI (#3863)
Adds Python 3.12 to CI.
Because `tree-sitter`/`tree-sitter-languages` can't be installed on 3.12 yet, we need to run slightly different commands when installing dependencies/running tests on 3.12.

See for more context: https://github.com/Textualize/textual/issues/3491#issuecomment-1854156476
2023-12-14 10:42:18 +00:00
Branch Vincent
f01d31ca01 drop importlib-metadata 2023-12-13 18:57:29 -08:00
Will McGugan
4bfb82ac06 fix update styles (#3860)
* fix update styles

* snapshot test, version bump

* changelog

* snapshot
2023-12-12 21:20:22 +00:00
Will McGugan
21ba7dbcf6 bump (#3855) 2023-12-12 14:42:07 +00:00
Will McGugan
a2a6f56cec docs fix (#3841) 2023-12-09 12:12:46 +00:00
Will McGugan
ad3934bc9d changelog and bump (#3803)
* changelog and bump

* diff
2023-12-04 13:56:49 +00:00
Will McGugan
e537125baa Catch no widget (#3790)
* Catch no widget

* changelog

* version bump

* remove prints
2023-12-01 11:50:46 +00:00
Darren Burns
5603a4da2b Fix GH Actions, remove Python 3.7, re-enable MacOS, remove old dev dependency (#3766)
* Fixing pytest running on incorrect Python version in GitHub actions.
Also removes 3.12 from the testing matrix, and enables MacOS again.

* Dropping Python 3.7

* Update required Python version to ^3.8

* Remove 3.7 asyncio compatibility layer

* Version pinning in GitHub Action
2023-11-29 14:05:25 +00:00
Will McGugan
1a76b628c7 fix threading issue (#3779)
* fix threading issue

* remote debug

* changelog

* version bump

* changelog

* docstring

* fix snapshot test
2023-11-29 13:28:24 +00:00
Will McGugan
0ec41af945 add mouse down handler (#3778)
* add mouse down handler

* changelog

* version bump
2023-11-29 10:18:18 +00:00
Will McGugan
60766a3056 version bump (#3770)
* version bump

* changelog
2023-11-28 14:32:18 +00:00
Will McGugan
a64a0d21d7 version bump (#3731) 2023-11-22 16:17:26 +00:00
Will McGugan
b3d60432f1 Version bump (#3621) 2023-10-31 13:24:03 +00:00
Will McGugan
cc5e14cbd6 version bump 2023-10-11 16:54:29 +01:00
Will McGugan
927e59b001 version bump (#3501) 2023-10-10 15:47:30 +01:00
Darren Burns
d2320f11fc Move tree-sitter and tree_sitter_languages to optional extras (#3398)
* Move tree-sitter and tree_sitter_languages to optional extras

* Update docs and GitHub action for moving syntax to extras

* Updating, remake lockfile

* Update snapshots from textual-dev change

* Improve warning when a language is set but tree-sitter not available

* Update CHANGELOG

* Add note on syntax extras

* Update lock
2023-10-09 10:57:13 +01:00
Dave Pearson
500857b5fb Merge branch 'main' into fix-print-console-location 2023-10-05 15:50:22 +01:00
Darren Burns
d7549d69ee Add 3.12 to classifiers (#3465) 2023-10-05 13:48:44 +01:00
Dave Pearson
f75bdc19da Upgrade to textual-dev 1.2.x 2023-09-28 14:02:27 +01:00
Will McGugan
9eb7b4c7c7 version bump 2023-09-21 17:16:49 +01:00
Will McGugan
701cd25472 new release (#3365)
* new release

* more release

* words

* Changelog

* remove words

* words
2023-09-21 12:56:20 +01:00
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
Will McGugan
e14cdd0757 version bump 2023-09-16 10:54:37 +01:00
Will McGugan
4dc8358c63 new release (#3316) 2023-09-15 16:40:05 +01:00
Dave Pearson
85a3af320a Merge branch 'main' into M-x 2023-09-06 14:46:33 +01:00
Will McGugan
11ba91a275 version bump (#3235) 2023-09-05 13:54:56 +01:00
Dave Pearson
110ea786ae Merge branch 'main' into M-x 2023-08-30 13:17:04 +01:00
Dave Pearson
6a73a2dce4 Update the pytest snapshot test library 2023-08-29 11:29:15 +01:00
Will McGugan
98168ae536 fix for textual-web flash 2023-08-28 14:19:47 +01:00
Will McGugan
2519063389 version bump (#3181)
* version bump

* changelog

* snapshot update
2023-08-26 17:19:13 +01:00
Will McGugan
821a60fe3b Win wait (#3151)
* input waiter

* waiter objects

* try signal handler for windows

* selectors

* fix win wait

* log meta

* log

* meta loop

* loop

* correct wait

* Waiter tweak

* timeout change

* restore loop

* change constant

* quit

* tweak

* loops

* debug

* debug

* exit on no data

* change wait

* loop tweak

* log

* change wait

* experiement

* wrap with handle

* experiment

* Debug

* handle

* DWORD

* another attempt

* test

* log

* reading

* stream

* tweak

* Restore

* input reader

* reader

* Remove debug

* input reader

* shutdown devtools after waiter

* flush

* fileno

* exit meta

* windows reader

* remove logging

* formatting

* docstring
2023-08-26 16:24:47 +01:00
Will McGugan
bc1af586b5 version bump (#3139)
* version bump

* changelog
2023-08-22 13:05:09 +01:00
Will McGugan
4e87a0f06e version bump (#3102) 2023-08-15 17:06:02 +01:00
Will McGugan
879c985296 Rich log (#3046)
* log

* tests

* snapshot tests

* change to richlog

* keep raw lines

* disable highlighting by default

* simplify

* superfluous test

* optimization

* update cell length

* add refresh

* write method

* version bump

* doc fix link

* makes lines private

* docstring

* relax dev dependancy

* remove superfluous code [skip ci]

* added FAQ [skipci]

* fix code in faq [skipci]

* fix typo

* max lines fix
2023-08-03 10:11:17 +01:00
Will McGugan
5a306e9c9f Bump0310 (#3044)
* bump version

* changelog
2023-08-01 11:01:53 +01:00
Will McGugan
ec58b914cf version bump (#2955)
* version bump

* tweak toast style, release post

* snapshots
2023-07-17 14:08:32 +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
darrenburns
ad4308562b Moving snap_compare to external package (#2849)
* Remove snap_compare fixture, extracted into external plugin

* Remove syrupy and Jinja2 dependencies

* Remove unused dependency
2023-06-27 14:37:41 +01:00
darrenburns
59b5ab0a55 Relax dependency of markdown-it-py (#2844) 2023-06-27 13:45:43 +01:00
Will McGugan
14aeb31cd9 minor bump (#2809)
* minor bump

* changelog
2023-06-20 09:27:17 +01:00